(function(){
XN.webpager={};
function Interface(_1,_2){
if(arguments.length!=2){
throw new Error("Interface constructror called with "+arguments.length+" arguments, but expected exactly 2.");
}
this.name=_1;
this.methods=[];
for(var i=0;i<_2.length;i++){
if(typeof _2[i]!="string"){
throw new Error("Interface constructor expects method names to be passed in as a string.");
}
this.methods.push(_2[i]);
}
}
Interface.ensureImplements=function(_4){
if(arguments.length<2){
throw new Error("function Interface.ensureImplements called with "+arguments.length+" arguments, but expected at least 2.");
}
for(var i=1;i<arguments.length;i++){
var _6=arguments[i];
if(_6.constructor!=Interface){
throw new Error("Function Interface.ensureImplements expects arguments two and above to be instance of Interface");
}
for(var j=0;j<_6.methods.length;j++){
var _8=_6.methods[j];
if(!_4[_8]||typeof _4[_8]!=="function"){
throw new Error("Function Interface.ensrueImplements: object does not implement the "+_6.name+" interface. Method: "+_8+" was not found.");
}
}
}
};
function extendClass(_9,_a){
var F=new Function();
F.prototype=_a.prototype;
_9.prototype=new F();
_9.prototype.constructor=_9;
_9.superClass=_a.prototype;
_9.prototype.superClass=_a;
_9.prototype.superPro=_a.prototype;
_a.prototype.constructor=_a;
}
var $=window.$;
if(window.asyncHTMLManager&&window.asyncHTMLManager.dom){
$=function(_d){
var t=window.$(_d);
if(t&&t.addEvent){
t.addEvent=function(_f,_10,_11){
window.asyncHTMLManager.dom.Element.prototype.addEvent.call(t,_f,_10,_11);
return t;
};
}
return t;
};
}
var _12=window.setTimeout;
var _13=window.setInterval;
if(window.asyncHTMLManager){
_12=asyncHTMLManager.__timer.setTimeout;
_13=asyncHTMLManager.__timer.setInterval;
}
XN.webpager.debug=0;
XN.webpager.logon=function(n){
this.debug=n||1;
var _15;
if(XN.browser.IE||!(window.console)||!(window.console.log)){
_15=function(msg){
if(XN.webpager&&XN.webpager.debug&&window.jash){
jash.print(msg);
}
};
}else{
if(window.console&&window.console.log){
_15=function(o){
if(XN.webpager&&XN.webpager.debug){
console.log(o);
}
};
}
}
this.writeLog=_15;
};
var _18={};
_18.log=function(n,_1a){
if(n<=XN.webpager.debug){
XN.webpager.writeLog(_1a);
}
};
_18.log1=function(_1b){
this.log(1,_1b);
};
_18.log2=function(_1c){
this.log(2,_1c);
};
if(window.location.toString().indexOf("webpager_debug")!=-1){
XN.webpager.logon(2);
}
(function(xw){
xw.Bling=function(_1e){
$extend(this,_1e);
};
xw.Bling.prototype={fn0:function(){
},fn1:function(){
},start:function(){
var _1f=this;
var i=0;
if(this.inter){
clearInterval(this.inter);
}
if(this.onStart){
this.onStart();
}
this.inter=_13(function(){
if(i++%2){
_1f.fn1();
}else{
_1f.fn0();
}
},this.timeInterv||1000);
},stop:function(){
clearInterval(this.inter);
this.fireEvent("view_bling_stoped");
}};
XN.event.enableCustomEvent(xw.Bling.prototype);
xw.BlingMgr={init:function(){
var _21=this;
var t1="\u3010\u65b0\u6d88\u606f\u3011- ";
var t0="\u3010\u3000\u3000\u3000\u3011- ";
var _24=function(){
var _25=document.title;
var _26=_25.indexOf(t1);
if(_26==-1){
_26=_25.indexOf(t0);
}
if(_26!=-1){
return _25.substring(_26+7);
}
return _25;
};
this.titleBling=new xw.Bling({onStart:function(){
if(document.title.indexOf("\u3010")!=-1){
return;
}
this.oldtitle=document.title;
},fn1:function(){
document.title=t1+_24();
},fn0:function(){
document.title=t0+_24();
}});
this.titleBling.addEvent("view_bling_stoped",function(){
document.title=_24();
});
}};
})(XN.webpager);
(function(ns){
ns.noticePool={pool:{},getNotice:function(id){
return this.pool[id];
},isAvailable:function(id){
if(!this.pool[id]){
return false;
}
return !!(this.pool[id].isAvailable());
},cancelNotice:function(id){
var n=this.getNotice(id);
if(!n){
return;
}
n.cancel();
},cancelAll:function(){
XN.array.each(this.pool,function(i,n){
n.canel();
});
},reset:function(){
XN.array.each(this.pool,function(i,n){
n.enable();
});
}};
ns.Notice=function(id,_31){
this.eleAry=[];
this.id=id;
this.cookie=_31;
ns.noticePool.pool[id]=this;
};
ns.Notice.prototype={cancel:function(){
XN.webpager.persistMgr.setWpiCookie(this.cookie,1,360);
},enable:function(){
XN.webpager.persistMgr.setWpiCookie(this.cookie,"",360,true);
},isAvailable:function(){
return !(!!XN.webpager.persistMgr.getWpiCookieBy(this.cookie));
},makeElement:function(_32){
var obj=this.data[_32];
var _34=$make("<div style=\"background:#d0e7fa;padding:5px 0;margin-top:5px;\" class=\"hbox\"><p><a style=\"float:right;cursor:hand;\" class=\"x-to-hide\"></a></p><p style=\"text-align:center;\"><img src=\""+(obj.icon||"http://s.xnimg.cn/imgpro/icons/client2.png")+"\"/> <a target=\"_blank\" href=\""+obj.link+"\">"+obj.content+"</a></p></div>");
_34=$(_34);
this.eleAry.push(_34);
return _34;
},getCookie:function(){
return XN.webpager.persistMgr.getWpiCookieBy(this.cookie);
},bindEvent:function(ele){
var _36=this;
$(Sizzle("a.x-to-hide",ele)[0]).addEvent("click",function(){
ele.hide();
XN.array.each(_36.eleAry,function(i,el){
ele&&el.hide();
});
_36.cancel();
});
}};
})(XN.webpager);
(function(ns){
ns.readly=function(obj){
obj.readyQ=[];
obj.isReady=false;
obj.ready=function(fn){
if(!this.isReady){
this.readyQ.push(fn);
}else{
fn.call(this);
}
};
obj.doReady=function(){
for(var i=0;i<this.readyQ.length;i++){
this.readyQ[i].call(this);
}
this.isReady=true;
};
};
})(XN.webpager);
XN.webpager.tools={getTime:function(d){
var d=d||new Date();
return this.two((d.getMonth()+1))+"-"+this.two(d.getDate())+" "+this.two(d.getHours())+":"+this.two(d.getMinutes());
},two:function(s){
if(parseInt(s)>9){
return s;
}
return "0"+s;
},log:function(url){
var img=new Image();
img.src=url;
},log2:function(url){
try{
window.imengine.WPC.PersistMgr.report(url);
}
catch(e){
}
},logExpt:function(_42,e){
this.log2(_42+"&e="+e);
},getFirst:function(el){
return el.firstChild.nodeType==1?el.firstChild:el.firstChild.nextSibling;
},getPageScroll:function(){
try{
var x,y;
if(window.pageYOffset){
y=window.pageYOffset;
x=window.pageXOffset;
}else{
if(document.documentElement&&document.documentElement.scrollTop){
y=document.documentElement.scrollTop;
x=document.documentElement.scrollLeft;
}else{
if(document.body){
y=document.body.scrollTop;
x=document.body.scrollLeft;
}
}
}
}
catch(e){
}
return {x:x,y:y};
},getWholeHeight:function(){
try{
if(document.documentElement){
return document.documentElement.scrollHeight;
}else{
if(document.body){
return document.body.scrollHeight;
}
}
}
catch(e){
}
},getClientHeight:function(){
if(document.documentElement){
return document.documentElement.clientHeight;
}
},noMoreThan:function(str,len){
if(!str){
return "";
}
if(str&&str.length<=len){
return str;
}
return str.substring(0,len)+"...";
},unescapeHTML:function(_49){
var n=document.createElement("div");
n.innerHTML=_49;
if(XN.browser.IE){
return n.innerText;
}else{
return n.textContent;
}
},htmlFilter:function(str){
str=str.replace(/&/g,"&amp;");
str=str.replace(/</g,"&lt;");
str=str.replace(/>/g,"&gt;");
return str;
},filter:function(str){
str=str.replace(/\n/g," ");
str=str.replace(/"/g,"\u201c");
return str;
},atFilter:function(str){
var _4e=/@([^\(\)@]+)\((\d+)\) /ig;
return str.replace(_4e,"<a target=\"_blank\" href=\"http://www.renren.com/profile.do?id=$2\">@$1 </a>");
},injectHtml:function(ele,str){
if(XN.browser.IE){
ele.appendChild(this.getDom(str));
}else{
ele.innerHTML=str;
}
},appendHTML5:function(ele,_52){
if(XN.browser.IE){
ele.appendChild(this.getDom(_52));
}else{
ele.appendChild($make(_52));
}
},getHTMLThumb:function(_53,num,_55,_56){
var t=_53;
if(_55===undefined){
_55=true;
}
if(!t){
return {subStr:"",rawStr:"",len:0,HTMLStr:""};
}
if(_55){
if(XN.browser.IE){
t=t.replace(/&apos;/g,"\"");
}
t=this.unescapeHTML(t);
}
var _58=/(<a.[^>]*>)|(<\/a>)/;
var _59=/(<a.[^>]*>)|(<\/a>)/g;
var tmp=rawStr=t.replace(_59,"");
var _5b=[];
var _5c;
var ret;
var i=0;
var _5f=false;
var k=0;
if(rawStr.length>num){
tmp=rawStr.substring(0,num);
_5c=t.charAt(0);
while(_5c){
if(_5c=="<"){
ret=_58.exec(t);
ret=ret[1]||ret[2];
_5b.push(ret);
if(ret[1]){
_5f=true;
}else{
_5f=false;
}
t=t.replace(_58,"");
}else{
i++;
t=t.substring(1);
_5b.push(_5c);
}
if(i>=num){
_5b.push((_56||"..."));
break;
}
_5c=t.charAt(0);
++k;
if(k>10000){
break;
}
}
}else{
_5b.push(t);
}
if(_5f){
_5b.push("</a>");
}
return {subStr:tmp+(_56||"..."),rawStr:rawStr,len:num,HTMLStr:_5b.join("")};
},getDom:function(str){
var tmp=document.createElement("div");
tmp.style.display="none";
document.body.appendChild(tmp);
tmp.innerHTML=str;
var dom=document.createDocumentFragment();
while(tmp.firstChild){
dom.appendChild(tmp.firstChild);
}
tmp.parentNode.removeChild(tmp);
return dom;
}};
XN.webpager.pagerTimer={init:function(){
var _64=this;
var _65=function(){
_64.fireEvent("webpager_tools_timer");
_64.sysTimer=_12(function(){
clearTimeout(_64.sysTimer);
_65();
},1500);
};
_65();
}};
XN.event.enableCustomEvent(XN.webpager.pagerTimer);
XN.webpager.tryer=function(){
};
XN.webpager.tryer.prototype={tryAWhile:function(_66,_67,fn){
this.clear();
var _69=this;
this._inter=_13(function(){
if(fn()===true){
_69.clear();
_69.fireEvent("tryer_sus");
}
},_66);
this._timeout=_12(function(){
_69.clear();
_69.fireEvent("tryer_timeout");
},_67);
},clear:function(){
clearInterval(this._inter);
clearTimeout(this._timeout);
}};
XN.event.enableCustomEvent(XN.webpager.tryer.prototype);
function $make(str){
var t=document.createElement("div");
t.innerHTML=str;
return (t.firstChild.nodeType==1)?t.firstChild:t.firstChild.nextSibling;
}
$extend(XN.webpager,{showWinsNum:0,isReady:false,showWins:[],curLayout:0,winMap:{},$id:0,groups:[],showWinNum:0,chatWordNum:140,url:{NOTIFY:"http://notify."+XN.env.domain+"/get.notify?view=1&nid=0&limit=10&rand="+Math.random(),DEL_NOTIFY:"http://notify."+XN.env.domain+"/remove.notify",OFFLINE_IMG:"http://head.xiaonei.com/photos/0/0/men_tiny.gif",WEB_ONLINE:"http://s.xnimg.cn/imgpro/icons/web_online_std.png",WEB_ONLINE_IE6:"http://s.xnimg.cn/imgpro/icons/web_online_ie6.gif",RR_ONLINE:"http://s.xnimg.cn/imgpro/icons/rr_online_std.png",RR_ONLINE_IE6:"http://s.xnimg.cn/imgpro/icons/rr_online_ie6.gif",WPI_CLOSE:"http://s.xnimg.cn/imgpro/icons/wpi_close_std.png",WPI_CLOSE_IE6:"http://s.xnimg.cn/imgpro/icons/wpi_close_ie6.gif",WPI_STATUS_COMMON:"http://s.xnimg.cn/imgpro/icons/wpi_status_common.png",WPI_STATUS_HLIGHT:"http://s.xnimg.cn/imgpro/icons/wpi_status_hlight.png",WPI_WEBTALK_CAMERA:"http://s.xnimg.cn/imgpro/icons/webtalk_camera.png",WPI_PHOTO_COMMON:"http://s.xnimg.cn/imgpro/icons/wpi_photo_common.png",WPI_PHOTO_HLIGHT:"http://s.xnimg.cn/imgpro/icons/wpi_photo_hlight.png",WPI_SHARE_COMMON:"http://xnimg.cn/imgpro/icons/share.gif",WPI_BULB:"http://a.xnimg.cn/imgpro/icons/bulb.png"},btnWidth:130,arrowWidth:46,layerIndex:1000,msg:{INPUT_DEFAULT:"\u8bf7\u8f93\u5165\u804a\u5929\u5185\u5bb9",TOO_LONG:"\u60a8\u53d1\u9001\u7684\u5185\u5bb9\u8d85\u8fc72000\u5b57, \u53d1\u9001\u5931\u8d25",NOTICE:"\u4e3a\u4fdd\u62a4\u4f60\u7684\u9690\u79c1\uff0c\u5c06\u9ed8\u8ba4\u6b64\u5bf9\u8bdd\u4e3a\u6084\u6084\u8bdd\uff01",NOTICE2:"\u5f00\u542f\u684c\u9762\u901a\u77e5\uff0c\u611f\u53d7\u5168\u65b0\u4f53\u9a8c\uff01",SPAM:{"-1":"\u60a8\u76ee\u524d\u4e0d\u5728\u767b\u5f55\u72b6\u6001\uff0c\u8bf7\u5c1d\u8bd5\u91cd\u65b0\u767b\u5f55\u540e\u518d\u8bd5\u3002\u5982\u679c\u60a8\u4e00\u76f4\u6536\u5230\u8fd9\u4e2a\u4fe1\u606f\uff0c\u8bf7\u8054\u7cfb\u7ba1\u7406\u5458",2:"\u8be5\u72b6\u6001\u4e0d\u5b58\u5728",4:"\u8bf7\u4e0d\u8981\u53d1\u5e03\u653f\u6cbb\u654f\u611f\u5185\u5bb9\u3001\u8272\u60c5\u5185\u5bb9\u3001\u5546\u4e1a\u5e7f\u544a\u6216\u5176\u4ed6\u4e0d\u6070\u5f53\u5185\u5bb9",5:"\u4f60\u77ed\u65f6\u95f4\u5185\u53d1\u8868\u4e86\u592a\u591a\u76f8\u540c\u7684\u5185\u5bb9"}},isHost:function(id){
return this.User.id==id;
},getCurWidth:function(){
return parseInt(this.webpagerDiv.getStyle("width"));
},getRestWidth:function(){
var _w=this.leftBundle.offsetWidth||215;
var _6e=_w+this.settingDiv.offsetWidth+this.friendsDiv.offsetWidth+this.notificationDiv.offsetWidth+this.arrowWidth;
return this.getCurWidth()-_6e;
},getGroupsWidth:function(){
return XN.element.getStyle(this.taskPanel,"width");
},setAvailableWidth:function(){
var t=this.getRestWidth();
this.taskPanel.style.width=(t-100)+"px";
},hideAllWin:function(){
XN.array.each(this.groups,function(i,_71){
_71.hide();
});
var _72="000";
XN.webpager.curLayout=parseInt(_72,2);
XN.webpager.persistMgr.saveLayout("l",XN.webpager.curLayout);
},getWinNum:function(){
if(this.tasks){
this.tasks.items.length;
}
return 0;
},collapseWinTagBy:function(tag){
XN.array.each(this.groups,function(i,_75){
_75.collapseWinTagBy(tag);
});
},parseStatus:function(_76){
var _77="\u7528\u6237\u79bb\u7ebf";
var _78=parseInt(_76);
var wpu=XN.webpager.url;
var _7a=XN.browser.IE6?"_IE6":"";
var _7b="WEB_";
var _7c="http://a.xnimg.cn/n/core/res/webpager/im_idle_dot.gif";
if((_78&8)==8){
_77="\u624b\u673a\u5728\u7ebf";
_7b="RR_";
_7c=wpu[_7b+"ONLINE"];
}else{
if((_78&4)==4){
_77="\u4eba\u4eba\u684c\u9762\u5728\u7ebf";
_7b="RR_";
_7c=wpu[_7b+"ONLINE"];
}else{
if((_78&2)==2){
_77="\u7f51\u9875\u5728\u7ebf";
_7c=wpu[_7b+"ONLINE"];
}
}
}
return {online:_77,online_type:_7b,icon:_7c,icon_toread_ie6:wpu[_7b+"ONLINE"+_7a],code:parseInt(_76)};
},backLayout:function(_7d){
_7d=_7d||XN.webpager.persistMgr.saveObj.l;
if(_7d===undefined){
return;
}
var _7e=_7d.toString(2);
if(!_7d){
_7e="000";
}
var len=_7e.length;
for(var i=len;i>0;i--){
(function(_81){
if(_7e.charAt(_81-1)=="1"){
window.ww=XN.webpager.winMap[len-_81];
_12(function(){
XN.webpager.winMap[len-_81].show(undefined,false);
},0);
}else{
XN.webpager.winMap[len-_81].hide();
}
})(i);
}
},ready:function(fn){
if(this.isReady){
fn.call(this);
}else{
if(!this.readyQ){
this.readyQ=[];
}
this.readyQ.push(fn);
}
},doReady:function(){
this.isReady=true;
if(this.readyQ.length){
var fn;
var _84=this;
for(var i=0;i<this.readyQ.length;i++){
fn=this.readyQ[i];
fn&&fn.call(_84);
}
this.readyQ.length=0;
}
},showPager:function(yes){
try{
if(yes){
XN.webpager.webpagerDiv.style.left="";
}else{
XN.webpager.webpagerDiv.style.left="-9999px";
}
}
catch(e){
}
}});
XN.webpager.MessagerProxy={send:function(g){
$wp_messager.send(g);
this.fireEvent("afterPost");
},getMessageHistory:function(_88){
var rs=$wp_messager.getMessageHistory(_88);
var _8a=[];
XN.array.each(rs,function(i,v){
_8a.push({msg_content:v.msg_content,time:XN.webpager.tools.getTime(new Date(parseInt(v.timestamp))),fromname:v.fromname,fromuin:v.fromuin});
});
return _8a;
},getNotifyHistory:function(){
return $wp_messager.getNotifyHistory();
},showChatMessage:function(e){
this.fireEvent("proxy_send_back",e);
},receive:function(_8e){
this.fireEvent("proxy_gossip_got",_8e);
},onSpeNotifyArrived:function(e){
XN.webpager.fireEvent("webpager_special_arrived",e);
},onRecvNotify:function(n){
_18.log1("********");
_18.log1(n);
var t=XN.json.parse(n.content);
if(document.domain=="kaixin.com"&&t&&t.time<0){
return;
}
var xw=XN.webpager;
if(t&&t.ugc_content&&document.domain!="kaixin.com"){
this.fireEvent("proxy_gossip_got",n,t);
}else{
XN.webpager.mgr.playSound();
this.fireEvent("proxy_notify_got",n);
}
},onRecvMessage:function(m){
if(m.r_id){
this.fireEvent("proxy_gossip_got",m);
}else{
var xw=XN.webpager;
if(!xw.isHost(m.from_id)){
_18.log1("\u8fd9\u4e0d\u662f\u81ea\u5df1\u7684\u5bf9\u8bdd\u6d88\u606f,\u64ad\u653e\u58f0\u97f3");
XN.webpager.mgr.playSound();
}
this.fireEvent("proxy_conv_got",m);
}
},showPager:function(yes){
XN.webpager.showPager(yes);
},onConnected:function(){
XN.webpager.mgr.fireEvent("mgr_connected");
},onDisconnected:function(){
XN.webpager.mgr.fireEvent("mgr_disConnected");
}};
$msg_proxy=XN.webpager.MessagerProxy;
XN.event.enableCustomEvent($msg_proxy);
XN.webpager.persistMgr={saveObj:{l:0,c:1},sectionMap:{conv:"",chat:"ChatRoom.chats"},init:function(){
this.load();
this.bindEvent();
},bindEvent:function(){
var _96=this;
XN.webpager.pagerTimer.addEvent("webpager_tools_timer",function(){
_96.load();
});
},get:function(key){
return this.saveObj[key];
},savethis:function(key,val){
this.saveObj[key]=val;
this.persist();
},save:function(_9a,obj){
var ids="";
var _9d="";
var _9e={};
$extend(_9e,obj);
if(_9a=="conv"){
for(var id in obj.models){
ids+=obj.models[id].serialize()+",";
}
ids=ids.substring(0,ids.length-1);
_9e.models=ids;
}
this.saveObj[_9a]=_9e;
this.persist();
},saveLayout:function(_a0,obj){
this.saveObj[_a0]=obj;
this.persist();
},getSaveObj:function(){
var obj=XN.json.parse(XN.cookie.get(XN.webpager.User.id+"wp_save"));
},destroyIt:function(id,_a4){
if(_a4){
_a4[id]=null;
if(this.saveObj[_a4._$$label][id]){
delete this.saveObj[_a4._$$label][id];
this.persist();
}
}
},getWpiCookie:function(key){
var obj=null;
try{
obj=XN.json.parse(window.imengine.imHelper.getCookie("wp_save"));
}
catch(e){
return null;
}
if(obj){
return obj[key];
}
return null;
},getWpiCookieBy:function(key){
return window.imengine.imHelper.getCookie(key);
},setWpiCookie:function(key,_a9,_aa,_ab){
var _ac=this;
if(this.cookieTimer){
clearTimeout(this.cookieTimer);
}
var _ad=function(){
window.imengine.imHelper.setCookie(key,_a9,_aa);
_ac.preModelStatus=_a9;
};
if(_ab){
_ad();
}else{
this.cookieTimer=_12(function(){
_ad();
},50);
}
},persist:function(){
this.saveObj.id=XN.webpager.User.id;
var str=XN.json.build(this.saveObj);
this.setWpiCookie("wp_save",str,365);
},load:function(){
var _af=window.imengine.imHelper.getCookie("wp_save");
if(_af){
var _b0=XN.json.parse(_af);
var _b1=XN.json.parse(this.preModelStatus);
if(_b0){
if(_b0.id!=XN.webpager.User.id){
return;
}
XN.webpager.initModelStatus=_b0;
XN.webpager.persistMgr.saveObj=_b0;
if(_b0.conv&&_b0.conv.models&&this.preModelStatus!=_af){
this.fireEvent("persist_modelStatus_dif",_b0,_b1);
}
if(_b0.conv&&_b0.conv.models==""&&this.preModelStatus!=_af){
this.fireEvent("persist_no_models");
}
if(XN.webpager.curLayout!=_b0.l){
this.fireEvent("persist_layout_dif",_b0.l);
}
if(XN.webpager.mgr.connConf!=_b0.c){
this.fireEvent("persist_conn_dif",_b0.c);
}
if(XN.webpager.curMusic!=_b0.m){
this.fireEvent("persist_setting_dif",_b0.m);
}
this.preModelStatus=_af;
XN.webpager.curLayout=_b0.l;
XN.webpager.curMusic=_b0.m;
}
}
},testLocalStorage:function(){
return window.imengine.persistMap.test();
}};
XN.event.enableCustomEvent(XN.webpager.persistMgr);
$extend(XN.webpager,{Gossip:function(_b2){
$extend(this,_b2);
},UGC:function(_b3){
$extend(this,_b3);
},User:{id:XN.cookie.get("id"),name:"\u6211",head:XN.webpager.url.OFFLINE_IMG}});
XN.webpager.abstractWindow=function(_b4){
this.init(_b4);
};
XN.webpager.abstractWindow.prototype={active:false,_modelFns:{},init:function(_b5){
var _b6=this;
this.element=$element("div");
this.element.className="popupwindow";
this.options=$extend(this.getDefaultOptions(),_b5);
this.renderWin();
this.addEvent("view_window_added",function(){
if(_b6.inited){
return;
}
_b6.getUIRef();
_b6.UIPrepare();
window.__logEvents=false;
_b6._addEvent();
if(_b6.xinit){
_b6.xinit();
_b6.fireEvent("view_window_inited");
}
_b6.inited=true;
});
},getDefaultOptions:function(){
return {canClose:true,canMax:false,canMin:true};
},show:function(_b7,_b8){
this.myGroup.showThis(this,_b8);
this.active=true;
if(_b7===false){
return;
}
this.fireEvent("view_window_active","",_b8);
XN.webpager.fireEvent("view_a_window_actived",this);
},hide:function(_b9){
$(this.element).delClass("actived");
this.active=false;
if(XN.browser.IE6){
this.element.getElementsByTagName("article")[0].style.visibility="hidden";
}
if(false===_b9){
return;
}
this.fireEvent("view_window_disactive");
XN.webpager.fireEvent("view_a_window_disactived",this);
},getId:function(){
return this.model.getId();
},saveLayout:function(ret,_bb){
var wp=XN.webpager;
var _bd=this.setLayout(wp.curLayout,this.id,ret);
wp.curLayout=_bd;
if(_bb===false){
return;
}
wp.persistMgr.saveLayout("l",wp.curLayout);
},setLayout:function(_be,_bf,ret){
if(ret){
return (1<<_bf|_be);
}else{
_be=_be.toString(2);
var len=_be.length;
_bf=len-_bf-1;
var a=_be.substring(0,_bf)+"0"+_be.substring(_bf+1);
return parseInt(a,2);
}
},remove:function(){
if(!$(this.element)){
return;
}
$(this.element).remove();
$(this.element).delClass("actived");
this.active=false;
this.fireEvent("view_window_destroy");
},renderWin:function(){
var _c3=["<div class=\"panelbarbutton\">",this.getButton(),this.options.canClose?"<menu><li class=\"close\" title=\"\u5173\u95ed\">\u5173\u95ed</li></menu>":"","</div>","<article class=\"window\">","<header>",this.getHeader(),"<menu>",this.options.canLeave?"<li class=\"leave\" label=\"\u9000\u51fa\" title=\"\u9000\u51fa\u8ba8\u8bba\">\u9000\u51fa</li>":"",this.options.canMin?"<li class=\"minimize\" label=\"\u6700\u5c0f\u5316\" title=\"\u6700\u5c0f\u5316\"></li>":"",this.options.canMax?"<li class=\"outlink\" label=\"\u6700\u5927\u5316\" title=\""+(this.canMaxTitle||"\u6d4f\u89c8\u66f4\u591a")+"\"></li>":"",this.options.canClose?"<li class=\"close\" label=\"\u5173\u95ed\" title=\"\u5173\u95ed\"></li>":"","</menu>","</header>","<section>",this.getContent(),"</section>","</article>"];
if(XN.browser.IE){
try{
var _c4=_c3.join("");
this.element.appendChild(XN.webpager.tools.getDom(_c4));
}
catch(e){
if(XN.DEBUG_MODE){
alert(_c4+"\n\n"+e.description);
}
XN.webpager.tools.logExpt("c10",e);
}
}else{
this.element.innerHTML=_c3.join("");
}
},getButton:function(){
throw new Error("This class: XN.webpager.abstractWindow is abstract and can not be initial");
},getHeader:function(){
throw new Error("This class: XN.webpager.abstractWindow is abstract and can not be initial");
},getContent:function(){
throw new Error("This class: XN.webpager.abstractWindow is abstract and can not be initial");
},getMessage:function(){
var _c5=[];
var _c6=this.options.replies;
for(var i=0;i<_c6.length;i++){
_c5.push(this.makeSection(_c6[i]));
}
return _c5.join("");
},getUIRef:function(){
throw new Error("This class:XN.webpager.abstractWindow is abstract and can not be initial");
},UIPrepare:function(){
},makeSection:function(obj){
var _c9=[];
_c9.push("<section>","<header>","<span class=\"user\">","<a href=\"\">",obj.name,"</a>","</span>","<span class=\"time\">",obj.time,"</span>","</header>","<section>","<p>",obj.content,"</p>","</section>","<footer>","<a href=\"#\">\u56de\u590d</a>","</footer>","</section>");
return _c9.join("");
},_addEvent:function(){
window.__logEvents=false;
var _ca=this;
var _cb=this.element.getElementsByTagName("li");
XN.array.each(_cb,function(i,v){
if(XN.element.hasClassName(v,"close")){
$(v).addEvent("click",function(){
_ca.active=false;
$(_ca.element).delClass("actived");
_ca.fireEvent("view_window_close");
XN.event.stop(arguments[0]);
});
}else{
if(XN.element.hasClassName(v,"outlink")){
$(v).addEvent("click",function(){
_ca.show();
_ca.fireEvent("view_window_maximize");
});
}else{
if(XN.element.hasClassName(v,"minimize")){
$(v).addEvent("click",function(){
_ca.hide();
});
}
}
}
});
this.button=$(this.element.firstChild);
$(this.button).addEvent("click",function(){
if(_ca.activeUnable){
return;
}
if(XN.element.hasClassName(_ca.element,"actived")){
_ca.myGroup.hasActive=false;
_ca.active=false;
_ca.hide();
_ca.fireEvent("ua_collapse_window");
}else{
_ca.active=true;
_ca.myGroup.hasActive=true;
var _t=_ca.element.getStyle("zIndex");
if(!_t||_t&&(_t<XN.webpager.layerIndex)){
_ca.element.style.zIndex=XN.webpager.layerIndex++;
}
if(XN.browser.IE6){
var _cf=_ca.element.getElementsByTagName("article")[0];
var _d0=_ca.element.getElementsByTagName("article")[0].style.width;
for(var i=0;i<_cf.children.length;i++){
_cf.children[i].style.width=_d0;
}
_cf.style.zoom="1";
}
_ca.show();
_ca.fireEvent("ua_open_window");
_ca.myGroup.fireEvent("view_group_has_active");
}
});
var _d2=this.element.getElementsByTagName("form")[0];
try{
if(_d2&&_d2&&/\beditor\b/.test(_d2.className)){
var _d3=XN.DOM.getElementsByClassName("button",_d2)[0];
var _d4=XN.DOM.getElementsByClassName("emotion",_d2)[0];
$(_d3)&&$(_d3).addEvent("click",function(e){
_d4.style.display="block";
XN.event.stop(e);
});
$(_d4)&&$(_d4).addEvent("mouseover",function(){
_d4.active=true;
}).addEvent("mouseout",function(){
_d4.active=false;
});
var _d6=_d2.getElementsByTagName("textarea")[0];
this.textarea=$(_d6);
}
}
catch(e){
if(XN.webpager.debug){
alert(e);
}
XN.webpager.tools.logExpt("c11",e);
}
if(this.xAddEvent){
this.xAddEvent();
}
},addModelEvent:function(_d7,fn,_d9){
if(!this._modelFns[_d7]){
this._modelFns[_d7]=[];
}
this._modelFns[_d7].push(fn);
if(_d9){
_d9.addEvent(_d7,fn);
}else{
this.model.addEvent(_d7,fn);
}
},destroy:function(){
this.remove();
},update:function(obj){
},$make:function(str){
var t=document.createElementByTagName("div");
t.innerHTML=str;
return (t.firstChild.nodeType==3)?t.firstChild:t.firstChild.nextSibling;
},showTip:function(){
},hideTip:function(){
}};
XN.event.enableCustomEvent(XN.webpager.abstractWindow.prototype);
XN.webpager.EmptyWindow=function(_dd){
$extend(this,_dd);
this.init(_dd);
$(this.element).addClass("popupwindow");
};
extendClass(XN.webpager.EmptyWindow,XN.webpager.abstractWindow);
$extend(XN.webpager.EmptyWindow.prototype,{xinit:function(){
if(this.width){
this.button.style.width=parseInt(this.width)+"px";
}
},show:function(){
if(this.activeUnable){
return;
}
this.superPro.show.apply(this,arguments);
},getDefaultOptions:function(){
var _de=XN.webpager.friendsWindow.superClass.getDefaultOptions.call(this);
return $extend(_de,{canClose:false,canMax:false});
},getButton:function(){
var _df=this.strButton||"";
return _df;
},getHeader:function(){
return ["<h4>",this.strTitle||"\u6211\u7684\u5e94\u7528","</h4>"].join("");
},getContent:function(){
this.strContent=this.strContent||"";
return this.strContent;
},getUIRef:function(){
},showElement:function(){
$(this.element).show();
},hideElement:function(){
$(this.element).hide();
}});
XN.event.enableCustomEvent(XN.webpager.EmptyWindow.prototype);
XN.webpager.windowInterface=new Interface("XN.webpager.windowInterface",["show","hide","remove"]);
XN.webpager.windowGroup=function(_e0){
this.items=[];
this.$id=0;
this.active=null;
this.container=$(_e0);
XN.webpager.groups.push(this);
if(this.bindEvent){
this.bindEvent();
}
};
XN.webpager.windowGroup.prototype={curWinsWidth:0,add:function(obj){
this.wrap(obj);
this.items.push(obj);
obj.myGroup=this;
obj.id=XN.webpager.$id++;
XN.webpager.winMap[obj.id]=obj;
this.container.insertBefore(obj.element,this.container.firstChild);
obj.fireEvent("view_window_added");
return this;
},show:function(obj){
XN.array.each(XN.webpager.groups,function(i,_e4){
for(index in _e4.items){
if(_e4.items[index]&&_e4.items[index]!=obj&&_e4.items[index].tag==obj.tag){
try{
_e4.items[index].hide(false);
}
catch(e){
XN.log(e);
XN.webpager.tools.logExpt("c09",e);
}
}
}
});
return this;
},showThis:function(obj,_e6){
var xws=XN.webpager.winSlider;
var _e8=xws.isInStack(obj);
if(_e8){
if(_e8.type=="left"){
xws.slideUntilShow(obj,"slideRight");
}else{
xws.slideUntilShow(obj,"slideLeft");
}
}else{
}
obj.fireEvent("view_before_show");
$(obj.element).addClass("actived");
if(XN.browser.IE6){
var _e9=obj.element.getElementsByTagName("article")[0];
var _ea=obj.element.getElementsByTagName("article")[0].style.width;
for(var i=0;i<_e9.children.length;i++){
_e9.children[i].style.width=_ea;
}
_e9.style.visibility="visible";
_e9.style.zoom="1.1";
_e9.style.zoom="1";
}
obj.fireEvent("view_after_show");
},remove:function(obj){
for(var i=0;i<this.items.length;i++){
if(this.items[i]==obj){
this.items.splice(i,1);
break;
}
}
if(!this.items.length){
this.fireEvent("view_no_windows");
}
return this;
},hide:function(){
for(var i=0;i<this.items.length;i++){
if(this.items[i].active||this.items[i].model&&this.items[i].model.started){
this.items[i].hide();
}else{
this.items[i].hide(false);
}
this.items[i].active=false;
}
},clear:function(){
for(var i=0;i<this.items.length;i++){
obj.remove();
}
this.items=[];
return this;
},collapseWinTagBy:function(tag){
for(var i=0;i<this.items.length;i++){
if(this.items[i].tag==tag){
this.items[i].hide();
}
}
},wrap:function(obj){
var _f3=this;
var _f4=obj.remove;
obj.remove=function(){
_f4.call(obj);
_f3.remove(obj);
_f3.location();
};
var _f5=obj.show;
obj.show=function(){
_f5.apply(obj,arguments);
_f3.show(obj);
_f3.location();
};
},getGroupWidth:function(){
return XN.element.getStyle(this.container,"width");
},location:function(){
if(this.container.id=="tasks-panel"&&this.active&&this.active.element&&XN.element.hasClassName(this.active.element,"actived")){
var _f6=$("webpager");
var _f7=XN.element.getPosition(this.active.element.firstChild,_f6);
var _f8=_f6.offsetWidth-_f7.left-this.active.element.firstChild.offsetWidth;
this.active.element.lastChild.style.right=(_f8-2)+"px";
}else{
delete this.active;
}
},reset:function(){
this.container.innerHTML="";
},getLayout:function(){
}};
XN.event.enableCustomEvent(XN.webpager.windowGroup.prototype);
(function(ns){
ns.ConvGroup=function(_fa){
ns.windowGroup.call(this,_fa);
};
extendClass(ns.ConvGroup,ns.windowGroup);
$extend(ns.ConvGroup.prototype,{winCache:{},bindEvent:function(){
},add:function(obj){
Interface.ensureImplements(obj,XN.webpager.windowInterface);
var _fc=this;
this.wrap(obj);
this.insert(obj);
obj.addEvent("view_window_destroy",function(){
ns.winSlider.getOneToClose(obj);
ns.winSlider.checkBtn();
});
obj.fireEvent("view_window_added");
return this;
},insert:function(obj,_fe){
obj.myGroup=this;
this.winCache[obj.getId()]=obj;
if(!_fe&&this.items.length){
this.container.insertBefore(obj.element,this.getInsertPoint(obj.beforeThis));
}else{
this.container.insertBefore(obj.element,this.container.firstChild);
}
this.pushItem(obj);
this.checkOverflow(obj);
this.fireEvent("view_a_window_added");
},prepareWinFor:function(_ff,_100){
var win=this.getWin(_ff.getId());
this.insert(win,true);
if(_100&&win.showHlight){
win.showHlight();
}
return win;
},getWin:function(id){
var ret;
for(var i=0;i<this.items.length;i++){
if(this.items[i].getId()==id){
ret=this.items[i];
break;
}
}
if(!ret){
ret=this.winCache[id];
}
return ret;
},pushItem:function(obj){
this.items.push(obj);
ns.winSlider.pushToShowQueue(obj);
},getInsertPoint:function(_106){
if(_106){
return this.getInsertSibEle(_106);
}
for(var i=this.items.length-1;i>=0;i--){
if(this.items[i].element.style.display!="none"){
return this.items[i].element;
}
}
},getInsertSib:function(id){
var _109=XN.webpager.persistMgr.saveObj.conv.models;
var _10a;
var xw=XN.webpager;
if(_109){
_10a=_109.split(",");
var len=_10a.length;
for(var i=0;i<len;i++){
if(_10a[i].indexOf(id)!=-1){
if(i){
return _10a[i-1];
}else{
return null;
}
}
}
}
},getInsertSibEle:function(id){
id=this.getInsertSib(id);
if(!id){
return null;
}
var xw=XN.webpager;
var _110=xw.tasks.items;
var len=_110.length;
for(var i=0;i<len;i++){
if(id.indexOf(_110[i].model&&_110[i].model.f_id)!=-1){
return _110[i].element;
}
}
return null;
},checkOverflow:function(obj){
var xw=XN.webpager;
if(this.isOverflow()){
XN.webpager.fireEvent("view_too_more_windows",obj);
}else{
XN.webpager.fireEvent("view_window_fix");
}
ns.winSlider.resetPanelWidth();
},isOverflow:function(){
var xw=XN.webpager;
var xwws=ns.winSlider;
var cur=xw.btnWidth*(xwws.showQueue.length);
return cur>xw.getRestWidth();
}});
ns.winSlider={init:function(){
this.getUIRef();
this.bindEvent();
this.showQueue=[];
this.leftHideStack=[];
this.rightHideStack=[];
},pushToShowQueue:function(obj){
this.pushQueue(obj);
},pushQueue:function(obj){
if(!obj){
return;
}
this.showQueue.push(obj);
XN.webpager.showWinNum=this.showQueue.length;
return obj;
},unshiftQueue:function(obj){
if(!obj){
return;
}
this.showQueue.unshift(obj);
XN.webpager.showWinNum=this.showQueue.length;
return obj;
},pushRight:function(obj){
if(!obj){
return;
}
this.rightHideStack.push(obj);
return obj;
},pushLeft:function(obj){
if(!obj){
return;
}
this.leftHideStack.push(obj);
return obj;
},bindEvent:function(){
var This=this;
XN.webpager.addEvent("view_too_more_windows",function(){
XN.webpager.showWinNum=Math.floor(XN.webpager.getRestWidth()/XN.webpager.btnWidth);
This.queueToRight();
This.show();
This.updateNum();
});
XN.webpager.addEvent("view_window_fix",function(){
This.hide();
});
XN.webpager.addEvent("view_resize_free_space",function(_11e,_11f){
var _120=_11e-_11f;
for(var i=0;i<_120;i++){
(function(_122){
_12(function(){
This.leftToQueue();
if(i==_120){
var _123=XN.webpager.winSlider.showQueue.length;
if(_11e!=_123){
for(i=_123;i<_11e;i++){
_12(function(){
This.rightToQueue();
},10);
}
}
}
},0);
})(i);
}
});
XN.webpager.addEvent("view_resize_lack_space",function(_124,_125){
for(var i=0;i<_125-_124;i++){
_12(function(){
This.queueToLeft();
},0);
}
This.show();
});
this.addEvent("slider_queue_added",function(ele){
ele&&ele.element.show();
This.updateNum();
});
this.addEvent("slider_queue_decrease",function(ele){
ele.element.hide();
This.updateNum();
});
if(!XN.browser.IE){
XN.event.addEvent(window,"resize",function(){
This.resizeCheck();
});
}
this.leftBtn.addEvent("click",function(){
This.leftBtn.getElementsByTagName("button")[0].blur();
This.slideRight();
});
this.rightBtn.addEvent("click",function(){
This.rightBtn.blur();
This.slideLeft();
if(XN.browser.IE6){
This.rightBtn.parentNode.parentNode.style.zoom="1.1";
This.rightBtn.parentNode.parentNode.style.zoom="1";
}
});
this.addEvent("view_window_slider_added",function(){
});
this.addEvent("view_window_slider_removed",function(){
This.resetPanelWidth();
});
},getOneToClose:function(obj){
var newQ=[];
var _12b=false;
var left;
var _12d;
var This=this;
XN.array.each(this.showQueue,function(i,win){
if(win===obj){
This.showQueue.splice(i,1);
_12b=true;
}
});
if(_12b){
_12d=this.rightToQueue();
if(!_12d){
left=this.leftToQueue();
}
if(!left){
this.fireEvent("view_window_slider_removed");
}
}else{
XN.array.each(this.rightHideStack,function(i,win){
if(win===obj){
var t=This.rightHideStack.splice(i,1);
if(t.length){
t[0].element.show();
}
return false;
}
});
}
},getUIRef:function(){
this.leftBtn=$("webpager_slider_left");
this.rightBtn=$("webpager_slider_right");
},slideLeft:function(){
if(!this.rightHideStack.length){
return;
}
if(!this.showQueue.length){
return;
}
var _134=this.queueToLeft();
var _135=this.rightToQueue();
return {show:_135,hide:_134};
},slideRight:function(){
if(!this.leftHideStack.length){
return;
}
if(!this.showQueue.length){
return;
}
var _136=this.queueToRight();
var _137=this.leftToQueue();
return {show:_137,hide:_136};
},queueToRight:function(){
var _138=this.pushRight(this.showQueue.shift());
this.fireEvent("slider_queue_decrease",_138);
return _138;
},rightToQueue:function(){
var _139=this.unshiftQueue(this.rightHideStack.pop());
this.fireEvent("slider_queue_added",_139);
return _139;
},queueToLeft:function(){
var left=this.pushLeft(this.showQueue.pop());
this.fireEvent("slider_queue_decrease",left);
return left;
},leftToQueue:function(_13b){
if(_13b){
var _13c=[];
for(var i=0;i<this.leftHideStack.length;i++){
if(this.leftHideStack[i]!=_13b){
_13c.push(this.leftHideStack[i]);
}
}
this.leftHideStack=_13c;
}else{
_13b=this.leftHideStack.pop();
}
var left=this.pushQueue(_13b);
this.fireEvent("slider_queue_added",left);
return left;
},checkBtn:function(){
if(!this.leftHideStack.length){
this.leftBtn.addClass("disable");
}else{
this.leftBtn.delClass("disable");
}
if(!this.rightHideStack.length){
this.rightBtn.addClass("disable");
}else{
this.rightBtn.delClass("disable");
}
if(!(this.leftHideStack.length+this.rightHideStack.length)){
this.hide();
}
this.updateNum();
},resizeCheck:function(){
var xw=XN.webpager;
var _140=xw.winSlider.showQueue.length;
var _141=Math.floor((xw.getRestWidth())/xw.btnWidth);
if(_140==_141){
return;
}else{
if(_141>_140){
xw.fireEvent("view_resize_free_space",_141,_140);
}else{
xw.fireEvent("view_resize_lack_space",_141,_140);
}
}
},updateNum:function(){
if(this.leftHideStack.length!==undefined){
this.leftBtn.getElementsByTagName("button")[0].innerHTML=this.leftHideStack.length;
this.leftBtn.title="\u5de6\u4fa7\u8fd8\u6709"+this.leftHideStack.length+"\u4e2a\u7a97\u53e3";
}else{
}
if(this.leftHideStack.length==0&&this.rightHideStack.length==0){
this.hide();
}
if(this.rightHideStack.length!==undefined){
this.rightBtn.getElementsByTagName("button")[0].innerHTML=this.rightHideStack.length;
this.rightBtn.title="\u53f3\u4fa7\u8fd8\u6709"+this.rightHideStack.length+"\u4e2a\u7a97\u53e3";
}else{
this.rightBtn.hide();
}
},resetPanelWidth:function(){
var xw=XN.webpager;
var _143=xw.winSlider.showQueue.length;
var _144=Math.floor((xw.getRestWidth())/xw.btnWidth);
var rest=Math.floor((xw.getRestWidth())/xw.btnWidth);
var _146=Math.min(rest,this.showQueue.length);
this.setPanelWidth(_146*xw.btnWidth);
},setPanelWidth:function(_147){
XN.webpager.taskPanel.style.width=_147+"px";
},isWindowOverflow:function(){
return XN.webpager.taskPanel.offsetHeight>26;
},isInStack:function(obj){
if(!obj&&!XN.DEBUG_MODE){
throw "[XN.webpager.winSlider.isInstack] not an object passed in!";
}
var ret=false;
var xw=XN.webpager;
for(var i=0;i<this.leftHideStack.length;i++){
if(this.leftHideStack[i]==obj){
return {type:"left"};
}
}
for(var i=0;i<this.rightHideStack.length;i++){
if(this.rightHideStack[i]==obj){
return {type:"right"};
}
}
return false;
},slideUntilShow:function(_14c,type){
var fn=this[type];
var ret=fn.call(this);
while(ret&&ret.show){
if(ret.show==_14c){
return;
}
ret=fn.call(this);
}
},show:function(){
this.leftBtn.show();
this.rightBtn.show();
},hide:function(){
this.leftBtn.hide();
this.rightBtn.hide();
}};
XN.event.enableCustomEvent(ns.winSlider);
})(XN.webpager);
XN.webpager.settingsWindow=function(_150){
_150=_150||{};
_150.tag="system";
$extend(this,_150);
this.init(_150);
$(this.element).addClass("popupwindow");
$(this.element).addClass("settings-panel");
};
extendClass(XN.webpager.settingsWindow,XN.webpager.abstractWindow);
$extend(XN.webpager.settingsWindow.prototype,{onlineSrc:"http://s.xnimg.cn/n/core/res/webpager/im_online.gif",offlineSrc:"http://s.xnimg.cn/n/core/res/webpager/im_offline.gif",getDefaultOptions:function(){
var _151=XN.webpager.friendsWindow.superClass.getDefaultOptions.call(this);
return $extend(_151,{canClose:false,canMax:false});
},getButton:function(){
return "<img id=\"wpi_online_img\" title=\"\u8bbe\u7f6e\" class=\"icon\" width=\"16\" height=\"16\" alt=\"\u5728\u7ebf\" src=\"http://a.xnimg.cn/n/core/res/webpager/im_online.gif\" />";
},getHeader:function(){
return ["<h4>\u804a\u5929\u548c\u63d0\u9192\u8bbe\u7f6e</h4>"].join("");
},getContent:function(){
return ["<div class=\"webpager-setting box\">","<article class=\"webpager-setting\">","<section>","<p><label><input name=\"music\" id=\"wpi_music\" type=\"checkbox\" checked=\"true\" /> \u6536\u5230\u65b0\u6d88\u606f\u64ad\u653e\u63d0\u793a\u97f3</label></p>","</section>","<footer>","<p><img id=\"wpi_login_img\" class=\"icon\" src=\"http://s.xnimg.cn/n/core/res/webpager/im_online.gif\"/> <span id=\"wpi_login_tip\">\u5df2\u542f\u7528\u804a\u5929\u548c\u63d0\u9192\u529f\u80fd</span> <a id=\"wpi_login_btn\" href=\"#\">\u5173\u95ed</a></p>","</footer>","</article>","</div>"].join("");
},getUIRef:function(){
this.onlineImg=$("wpi_online_img");
this.loginBtn=$("wpi_login_btn");
this.loginTip=$("wpi_login_tip");
this.loginLogo=$("wpi_login_img");
this.musicCheck=$("wpi_music");
},xAddEvent:function(){
var This=this;
var xw=XN.webpager;
this.loginBtn.addEvent("click",function(e){
if(This.loginBtn.innerHTML=="\u5173\u95ed"){
xw.mgr.disConnect();
}else{
xw.mgr.connect();
}
XN.event.stop(e||window.event);
});
this.addEvent("ua_open_window",function(_155){
var _156="001";
XN.webpager.curLayout=parseInt(_156,2);
XN.webpager.persistMgr.saveLayout("l",XN.webpager.curLayout);
});
this.addEvent("ua_collapse_window",function(_157){
var _158="000";
XN.webpager.curLayout=parseInt(_158,2);
XN.webpager.persistMgr.saveLayout("l",XN.webpager.curLayout);
});
this.musicCheck.addEvent("change",function(){
This.musicOn(This.musicCheck.checked);
});
xw.mgr.addEvent("mgr_disConnected",function(){
This.showOffline();
});
xw.mgr.addEvent("mgr_connected",function(){
This.showOnline();
});
xw.mgr.addEvent("mgr_connectFaild",function(){
This.showConnFaild();
});
xw.mgr.addEvent("mgr_connecting",function(){
This.showConning();
});
xw.persistMgr.addEvent("persist_setting_dif",function(isOn){
This.musicOn(isOn);
});
},musicOn:function(isOn,_15b){
isOn=isOn===undefined?true:isOn;
webpager.setPlaySound(isOn);
this.musicCheck.checked=isOn;
if(_15b===false){
return;
}
XN.webpager.persistMgr.saveLayout("m",isOn?1:0);
},showOnline:function(){
var xw=XN.webpager;
this.loginBtn.innerHTML="\u5173\u95ed";
this.loginTip.innerHTML="\u5df2\u542f\u7528\u804a\u5929\u548c\u63d0\u9192\u529f\u80fd";
this.onlineImg.src=this.onlineSrc;
this.loginLogo.src=this.onlineSrc;
xw.taskPanel.show();
xw.friendsDiv.show();
xw.notificationDiv.show();
},showOffline:function(){
var xw=XN.webpager;
this.loginBtn.innerHTML="\u6253\u5f00";
this.loginTip.innerHTML="\u5df2\u5173\u95ed\u804a\u5929\u548c\u63d0\u9192\u529f\u80fd";
this.loginLogo.src=this.offlineSrc;
this.onlineImg.src=this.offlineSrc;
xw.friendsDiv.hide();
xw.notificationDiv.hide();
},showConnFaild:function(){
var xw=XN.webpager;
this.loginBtn.innerHTML="\u91cd\u8bd5";
this.loginTip.innerHTML="\u4e0e\u670d\u52a1\u5668\u8fde\u63a5\u5931\u8d25";
this.loginLogo.src=this.offlineSrc;
this.onlineImg.src=this.offlineSrc;
xw.taskPanel.hide();
xw.friendsDiv.hide();
xw.notificationDiv.hide();
},showConning:function(){
this.loginBtn.innerHTML="";
this.loginTip.innerHTML="\u6b63\u5728\u4e0e\u670d\u52a1\u5668\u8fde\u63a5...";
this.loginLogo.src=this.offlineSrc;
this.onlineImg.src=this.offlineSrc;
}});
XN.webpager.WidgetGroup=function(_15f){
this.items=[];
this.container=$(_15f);
if(this.bindEvent){
this.bindEvent();
}
};
XN.webpager.WidgetGroup.prototype={add:function(obj){
this.items.push(obj);
obj.myGroup=this;
this.container.insertBefore(obj.element,this.container.firstChild);
obj.fireEvent("view_widget_added");
},hide:function(){
this.container.hide();
}};
XN.webpager.Widget=function(conf){
$extend(this,conf);
this.init();
};
XN.webpager.Widget.prototype={init:function(){
this.element=$element("div");
this.element.innerHTML=this.strContent;
}};
XN.event.enableCustomEvent(XN.webpager.Widget.prototype);
XN.webpager.notifyWindow=function(_162){
this.model=_162.model;
_162.tag="system";
$extend(this,_162);
this.init(_162);
$(this.element).addClass("popupwindow");
$(this.element).addClass("notify-panel");
};
extendClass(XN.webpager.notifyWindow,XN.webpager.abstractWindow);
$extend(XN.webpager.notifyWindow.prototype,{toread:0,active:false,xAddEvent:function(){
var This=this;
var xw=XN.webpager;
this.notifyList.addEvent("click",function(e){
e=e||window.event;
var obj=e.srcElement||e.target;
if(obj.getAttribute("source")){
if(obj.getAttribute("callback")){
This.model.delANotify(obj.getAttribute("nid"),obj.getAttribute("callback"));
}else{
var _167=XN.webpager.url.DEL_NOTIFY+"?uid="+XN.webpager.User.id+"&source="+obj.getAttribute("source");
This.model.delNotify(obj.getAttribute("source"),_167);
}
}
});
this.addEvent("ua_open_window",function(_168){
var _169="010";
XN.webpager.curLayout=parseInt(_169,2);
XN.webpager.persistMgr.saveLayout("l",XN.webpager.curLayout);
});
this.addEvent("ua_collapse_window",function(_16a){
var _16b="000";
XN.webpager.curLayout=parseInt(_16b,2);
XN.webpager.persistMgr.saveLayout("l",XN.webpager.curLayout);
});
this.addEvent("view_window_active",function(){
This.active=true;
This.model.loadNotifies();
xw.BlingMgr.titleBling.stop();
This.tipBling.stop();
This.hideTip();
});
this.addEvent("view_window_disactive",function(){
This.active=false;
});
this.model.addEvent("notifyBox_notify_updated",function(n){
if(n.source=="193-1"){
return;
}
if(!This.active){
This.toread++;
This.toreadNum.innerHTML=This.toread;
if(webpager.isLocalConnect()){
xw.BlingMgr.titleBling.start();
}
This.tipBling.start();
This.showTip();
}
This.showNotifies();
XN.webpager.mgr.playSound();
});
this.model.addEvent("notifyBox_notify_none",function(n){
This.showNotifies();
});
this.model.addEvent("notifyBox_notify_replace",function(n){
This.showNotifies();
});
webpager.addEvent("storage",function(e){
if(e.keys&&e.keys.indexOf("bling")!==-1){
if(!webpager.getItem("bling")){
This.cancelBlings();
}
}
});
},cancelBlings:function(){
XN.webpager.BlingMgr.titleBling.stop();
this.tipBling.stop();
this.hideTip();
},cancelAllBlings:function(){
webpager.setItem("bling","");
},getDefaultOptions:function(){
var _170=XN.webpager.friendsWindow.superClass.getDefaultOptions.call(this);
return $extend(_170,{canClose:false,canMax:false});
},getButton:function(){
return "<img class=\"icon\" width=\"16\" height=\"16\" title=\"\u63d0\u9192\" alt=\"\u63d0\u9192\" src=\"http://a.xnimg.cn/n/core/res/webpager/notifications.gif\" /><div id=\"wpi_toread_tip\" tooltip\" class=\"buttontooltip\" style=\"display:none;\"><strong id=\"wpi_toread_num\">3</strong></div>";
},getHeader:function(){
return ["<h4>\u63d0\u9192</h4>"].join("");
},getContent:function(){
if(!this.model.notifies.length){
return "<p style=\"padding:5px\">\u6ca1\u6709\u63d0\u9192</p>";
}
var This=this;
var html="<div class=\"notification\">";
for(var p=0;p<this.model.notifies.length;p++){
html+=this.makeANotify(this.model.notifies[p]);
}
html+="</div>";
return html;
},makeANotify:function(n){
var _175=n.callback+"&nid="+n.nid;
return ["<article class=\"iconpanel\">","\t<header>","\t\t<img class=\"icon\" width=\"16\" height=\"16\" src=\""+n.icon+"\"/>","\t\t<menu>","\t\t\t<command title=\"\u5220\u9664\" class=\"delete\" source=\"",n.source,"\" nid=\""+n.nid+"\" callback=\""+_175+"\" closeBtn=\"true\" />","\t\t</menu>","\t</header>","\t<section>","\t\t<p>"+n.content+"</p>","\t</section>","</article>"].join("");
},getUIRef:function(){
var This=this;
this.notifyList=$(this.element.getElementsByTagName("section")[0]);
this.btnTip=$("wpi_toread_tip");
this.toreadNum=$("wpi_toread_num");
this.tipBling=new XN.webpager.Bling({fn1:function(){
This.btnTip.show();
},fn0:function(){
This.btnTip.hide();
}});
},showNotifies:function(n){
this.notifyList.innerHTML=this.getContent();
},showTip:function(num){
if(!this.toread){
return;
}
this.btnTip.show();
},hideTip:function(){
this.toread=0;
this.btnTip.hide();
XN.log("hide Tip : "+this.toread);
}});
XN.webpager.notifyBox={notifies:[],delQ:[],init:function(){
this.bindEvent();
},bindEvent:function(){
var This=this;
XN.webpager.RoomKeeper.addEvent("keeper_notify_got",function(n){
_18.log1("\u901a\u77e5\u7684\u5185\u5bb9\u662f:");
_18.log1(n);
var json=XN.json.parse(XN.webpager.tools.unescapeHTML(n.content));
This.notifies.unshift(json);
This.fireEvent("notifyBox_notify_updated",json);
});
},makeNotifyUrl:function(_17c,nid){
var _17e=XN.webpager.url.DEL_NOTIFY+"?uid="+XN.webpager.User.id+"&source="+_17c;
return _17e;
},delAll:function(_17f,_180){
_18.log1("\u5220\u9664\u6240\u6709notify...\u5f53\u524d\u5f85\u5220notify\u6570\u91cf\u4e3a:"+this.delQ.length);
var n=this.delQ.pop();
while(n){
if(n){
n.call(this);
}
n=this.delQ.pop();
}
_18.log1("\u6240\u6709notify\u5220\u9664\u540e\u5269\u4e0b\uff1a"+this.delQ.length);
if(window.delBySource){
_18.log1("\u8c03\u7528\u9996\u9875\u7684\u65b9\u6cd5delBySource");
delBySource(_180+_17f);
}
},delANotify:function(nid,_183){
var This=this;
for(var i=0;i<this.notifies.length;i++){
if(this.notifies[i].nid==nid){
this.notifies.splice(i,1);
break;
}
}
new XN.net.xmlhttp({url:_183,onSuccess:function(){
This.replaceNotify(This.notifies);
}});
},delNotify:function(_186,_187,nid){
_187=_187||this.makeNotifyUrl(_186);
var This=this;
var ret=[];
_18.log1("\u904d\u5386notify\u6570\u7ec4,\u51c6\u5907\u5220\u9664(by source "+_186+")");
for(var i=0;i<this.notifies.length;i++){
_18.log1(i+": "+this.notifies[i].source);
if(this.notifies[i].source!=_186){
ret.push(this.notifies[i]);
}else{
_18.log1("\u627e\u5230\u4e00\u4e2asource\u4e00\u6837\u7684notify, del \u4e4b!");
}
}
_18.log1("\u7ecf\u8fc7\u5220\u9664\u7684\u6570\u7ec4(\u8fd8\u6ca1\u66f4\u65b0\u6a21\u578b,\u53ea\u662f\u4e34\u65f6\u7684\u53d8\u91cf):");
_18.log1(ret);
if(this.notifies.length==ret.length){
return;
}
new XN.net.xmlhttp({url:_187,onSuccess:function(){
This.replaceNotify(ret);
}});
if(!this.notifies.length){
this.fireEvent("notifyBox_notify_none",seq);
}
},getLen:function(o){
var len=0;
for(p in o){
len++;
}
return len;
},replaceNotify:function(nAry){
this.notifies=nAry;
this.fireEvent("notifyBox_notify_replace");
},mergeNotify:function(a1,a2){
if(!a2.length){
return a1;
}
var ret={};
var _192=[];
var len1=a1.length;
var len2=a2.length;
a1=a1.concat(a2);
for(var i=0;i<a1.length;i++){
ret[a1[i].nid]=a1[i];
}
for(n in ret){
_192.push(ret[n]);
}
_192.sort(function(a,b){
return a.nid<b.nid;
});
return _192;
},loadNotifies:function(){
var This=this;
var p={view:1,nid:0,limit:10,rand:Math.random()};
new XN.net.xmlhttp({url:XN.webpager.url.NOTIFY,data:XN.array.toQueryString(p),onSuccess:function(r){
var ary=XN.json.parse(r.responseText);
if(ary){
This.replaceNotify(ary);
}
}});
}};
XN.event.enableCustomEvent(XN.webpager.notifyBox);
XN.webpager.friendsWindow=function(_19c){
this.type="friendsWindow";
_19c.tag="system";
this.model=_19c&&_19c.model;
$extend(this,_19c);
this.init(_19c);
this.model.init();
$(this.element).addClass("friends-panel");
};
extendClass(XN.webpager.friendsWindow,XN.webpager.abstractWindow);
$extend(XN.webpager.friendsWindow.prototype,{curLiIndex:-1,xinit:function(){
var This=this;
This.curValue="";
This._searchHelper=XN.form.help(this.friendSearch).setDefaultValue("\u641c\u7d22\u597d\u53cb");
_13(function(){
if(This._searchHelper.getRealValue()!=This.curValue){
This.curValue=This._searchHelper.getRealValue();
This.fireEvent("view_search_value_change",This.curValue);
}
},800);
},xAddEvent:function(){
XN.log("[friendWindow.prototype.xaddEvent] binding event");
var This=this;
this.addEvent("ua_open_window",function(_19f){
var _1a0="100";
XN.webpager.curLayout=parseInt(_1a0,2);
XN.webpager.persistMgr.saveLayout("l",XN.webpager.curLayout);
});
this.addEvent("ua_collapse_window",function(_1a1){
var _1a2="000";
XN.webpager.curLayout=parseInt(_1a2,2);
XN.webpager.persistMgr.saveLayout("l",XN.webpager.curLayout);
});
this.addEvent("view_window_active",function(_1a3,_1a4){
This.friendSearch.value="";
This.model.fetOnlineFriend();
if(_1a4!==false){
This._searchHelper.focus();
}
});
this.addEvent("view_window_disactive",function(_1a5){
});
this.friendList.addEvent("click",function(e){
e=e||window.event;
var ta=e.srcElement||e.target;
if(ta.getAttribute("userId")){
This.fireEvent("selectAFriend",This.model.map[ta.getAttribute("userId")]);
XN.webpager.RoomKeeper.findConv(This.model.map[ta.getAttribute("userId")]);
}
XN.webpager.fireEvent("view_friendList_click",ta);
});
this.searchReset.addEvent("click",function(){
This.friendSearch.value="";
This.friendSearch.focus();
});
this.addEvent("view_search_value_change",function(_1a8){
if(_1a8){
This.searchReset.show();
}else{
This.searchReset.hide();
}
var _1a9=XN.webpager.friendbook.search(_1a8);
This.updateFriends(_1a9);
This._searchReset();
});
this.addEvent("view_window_disactive",function(){
This._searchReset();
});
XN.event.addEvent(this.friendSearch,"keydown",function(e){
if(!This.active){
return;
}
e=e||window.event;
if(e.keyCode==38){
This.selectedFriend=This.searchMove("up");
}else{
if(e.keyCode==40){
This.selectedFriend=This.searchMove("down");
}else{
if(e.keyCode==13){
var ta=This.selectedFriend;
if(ta&&ta.getAttribute("userId")){
This.fireEvent("selectAFriend",This.model.map[ta.getAttribute("userId")]);
XN.webpager.RoomKeeper.findConv(This.model.map[ta.getAttribute("userId")]);
}
XN.event.stop(e);
}
}
}
});
this.model.addEvent("friendbook_count_got",function(_1ac){
This.updateCount(_1ac);
});
this.model.addEvent("friendbook_friends_got",function(obj,_1ae){
if(!_1ae){
This.updateFriends(obj.friends);
}
});
this.model.addEvent("friendbook_before_friends_got",function(obj){
This.friendList.innerHTML="<li>\u6b63\u5728\u52a0\u8f7d...</li>";
});
},searchMove:function(_1b0){
var _1b1=this.curLiIndex;
var _1b2=this.friendList.childNodes;
var _1b3=_1b2.length;
if(_1b1>=0){
$(_1b2[_1b1]).delClass("current");
}
if(_1b0=="up"){
--_1b1;
}else{
++_1b1;
_1b1=_1b1>_1b3-1?_1b3-1:_1b1;
}
_1b1=_1b1<0?0:_1b1;
this.curLiIndex=_1b1;
$(_1b2[_1b1]).toggleClass("current");
return _1b2[_1b1];
},_searchReset:function(){
this.curLiIndex=-1;
this.selectedFriend&&this.selectedFriend.delClass("current");
},toggleSelect:function(li){
$(li).toggleClass("current");
},getDefaultOptions:function(){
var _1b5=XN.webpager.friendsWindow.superClass.getDefaultOptions.call(this);
return $extend(_1b5,{canClose:false,canMax:false});
},show:function(){
XN.webpager.friendsWindow.superClass.show.apply(this,arguments);
},getButton:function(){
return "<img class=\"icon\" width=\"16\" height=\"16\" alt=\"\u804a\u5929\" src=\"http://a.xnimg.cn/n/core/res/webpager/onlinegroup_mini.gif\" /> \u5728\u7ebf\u597d\u53cb(<span id=\"webpager_online_friend_count\">0</span>)";
},getHeader:function(){
return ["<h4>\u5728\u7ebf\u597d\u53cb</h4>"].join("");
},getContent:function(){
return ["<article class=\"online-users\">","<header>","<div class=\"searchbar box\">","<form class=\"searchbar\" action=\"#\" method=\"post\">","<input id=\"webpager_friend_search\" type=\"text\" onsubmit=\"return false;\" autocomplete=\"off\" />","<span id=\"webpager_friend_search_reset\" class=\"clear\"><a href=\"#\"><img src=\"http://a.xnimg.cn/n/core/res/webpager/clear.png\" alt=\"\u6e05\u9664\" /></a></span>","</form>","</div>","</header>","<section>","<ul class=\"user\">","</ul>","</section>","</article>"].join("");
},getUIRef:function(){
this.count=$("webpager_online_friend_count");
this.friendList=$(this.element.getElementsByTagName("ul")[0]);
this.friendSearch=$("webpager_friend_search");
this.searchReset=$("webpager_friend_search_reset");
this.searchReset.hide();
},makePerson:function(obj){
var o=XN.webpager.parseStatus(obj.status);
if((o.code&4)==4||(o.code&8)==8){
obj.videoviewpower=false;
}
var icon=o.icon;
var _1b9=o.online;
return ["<li userId=\"",obj.id,"\">","<span class=\"avatar\" userId=\"",obj.id,"\"><a href=\"#\"><img userId=\"",obj.id,"\" src=\"",obj.tiny,"\"/></a></span>","<span class=\"name\" userId=\"",obj.id,"\"><a userId =\"",obj.id,"\" href=\"\" onclick=\"return false;\">",obj.name,"</a></span>"," <span class=\"online-status\"><a><img title=\"",_1b9,"\" src=\"",icon,"\"/></a></span>",obj.videoviewpower?"<span class=\"online-status\"><a cam=\"1\" calleeId=\""+obj.id+"\" href=\"#\" onclick=\"return false;\"><img cam=\"1\" calleeId=\""+obj.id+"\" title=\"\u89c6\u9891\u804a\u5929\" src=\""+XN.webpager.url.WPI_WEBTALK_CAMERA+"\"/>&nbsp;</a></span> ":"","</li>"].join("");
},makePeople:function(objs){
var This=this;
var _1bc=[];
XN.array.each(objs,function(i,obj){
_1bc.push(This.makePerson(obj));
});
return _1bc.join("");
},updateCount:function(_1bf){
this.count.innerHTML=_1bf;
},updateFriends:function(_1c0){
this.friendList.innerHTML="";
this.friendList.innerHTML=this.makePeople(_1c0);
}});
XN.event.enableCustomEvent(XN.webpager.friendsWindow.prototype);
XN.webpager.friendbook={map:{},userInfo:{},init:function(){
this.bindEvent();
if(XN.webpager.initModelStatus){
this.fetOnlineFriend(true);
}else{
this.getOnlineCount();
}
},updateFriends:function(ret){
var This=this;
XN.array.each(ret.friends,function(i,_1c4){
This.map[_1c4.id]=_1c4;
});
},bindEvent:function(){
var This=this;
this.addEvent("friendbook_count_got",function(_1c6,ret){
var User=XN.webpager.User;
XN.webpager.User.name=ret.hostname;
XN.webpager.User.id=ret.hostid;
XN.webpager.User.head=ret.tinyurl||User.head;
});
this.addEvent("friendbook_friends_got",function(ret,_1ca){
var User=XN.webpager.User;
XN.webpager.User.name=ret.hostname;
XN.webpager.User.id=ret.hostid;
if(_1ca){
return;
}
XN.array.each(ret.friends,function(i,_1cd){
This.map[_1cd.id]=_1cd;
});
});
this.addEvent("friendbook_initFriends_got",function(ret){
var User=XN.webpager.User;
XN.webpager.User.name=ret.hostname;
XN.webpager.User.id=ret.hostid;
});
},getFriendCache:function(){
var wpu=XN.webpager.User;
this.fireEvent("friendbook_friends_got",{friends:this.map,hostname:wpu.name,hostid:wpu.id},true);
},fetOnlineFriend:function(_1d1,fn){
var This=this;
if(this.pause){
this.getFriendCache();
if(fn){
fn();
}
}else{
this.getOnlineFriend(_1d1,fn);
this.pause=true;
this.pauseTimer=_12(function(){
This.pause=false;
clearTimeout(This.pauseTimer);
},60000);
}
},getOnlineFriend:function(_1d4,fn){
var This=this;
this.fireEvent("friendbook_before_friends_got");
new XN.net.xmlhttp({url:"http://notify."+XN.env.domain+"/wpi/getonlinefriends.do?ran="+Math.random(),onSuccess:function(r){
var ret=XN.json.parse(r.responseText);
if(ret){
This.fireEvent("friendbook_before_update_friends",ret);
This.updateFriends(ret);
if(!_1d4){
This.fireEvent("friendbook_friends_got",ret);
}else{
This.fireEvent("friendbook_initFriends_got",ret);
}
This.fireEvent("friendbook_count_got",ret.onlineFriendsCount,ret);
}
if(fn){
fn();
}
}});
},getOnlineFriend2:function(fn){
var This=this;
new XN.net.xmlhttp({url:"http://wpi."+XN.env.domain+"/getonlinefriends.do?ran="+Math.random(),onSuccess:function(r){
var ret=XN.json.parse(r.responseText);
if(ret){
This.updateFriends(ret);
}
if(fn){
fn();
}
}});
},getOnlineCount:function(){
var This=this;
new XN.net.xmlhttp({url:"http://notify."+XN.env.domain+"/wpi/getonlinecount.do?ran="+Math.random(),onSuccess:function(r){
var ret=XN.json.parse(r.responseText);
if(ret){
try{
This.fireEvent("friendbook_before_count_got",ret.onlineFriendsCount,ret);
This.fireEvent("friendbook_count_got",ret.onlineFriendsCount,ret);
}
catch(e){
if(XN.DEBUG_MODE){
alert(e);
}
XN.webpager.tools.logExpt("c21",e);
}
}else{
if(XN.DEBUG_MODE){
alert("friends load failed");
}
}
}});
},getUserInfo:function(_1e0,fn){
var This=this;
new XN.net.xmlhttp({url:"http://friend.renren.com/ajaxGetTinyUrl",data:"param="+_1e0,onSuccess:function(r){
var obj=XN.json.parse(r.responseText);
if(fn){
fn(obj,r);
}
}});
},getTiny:function(id){
return XN.webpager.friendbook.map[id]&&XN.webpager.friendbook.map[id].tiny||this.userInfo[id]&&this.userInfo[id].head;
},search:function(key){
if(!key){
return this.map;
}
var _1e7={};
var name;
XN.array.each(this.map,function(i,_1ea){
name=_1ea.name;
if(name.indexOf(key)!=-1){
_1e7[_1ea.id]=_1ea;
}
});
return _1e7;
}};
XN.event.enableCustomEvent(XN.webpager.friendbook);
XN.webpager.mgr={isOnline:false,connConf:1,init:function(){
this.connTry=new XN.webpager.tryer();
this.disconnTry=new XN.webpager.tryer();
if(XN.webpager.persistMgr.getWpiCookie("c")===0){
this.disConnect();
}else{
}
this.bindEvent();
},bindEvent:function(){
var This=this;
var xw=XN.webpager;
xw.persistMgr.addEvent("persist_conn_dif",function(c){
if(c){
This.fireEvent("mgr_connected");
}else{
if(webpager.isLocalConnect()){
This.disConnect();
}
This.fireEvent("mgr_disConnected");
}
});
this.connTry.addEvent("tryer_timeout",function(){
This.connectFaild();
});
this.connTry.addEvent("tryer_sus",function(){
This.fireEvent("mgr_connected");
});
this.disconnTry.addEvent("tryer_sus",function(){
This.fireEvent("mgr_disConnected");
});
},connect:function(){
var This=this;
this.isOnline=true;
this.fireEvent("mgr_connecting");
webpager.enableConn(true);
this.connTry.tryAWhile(1000,20000,function(){
_18.log1("\u8fde\u63a5\u72b6\u6001: "+webpager.getConnState());
if(webpager.getConnState()){
This.saveConn(true);
return true;
}
});
},disConnect:function(save){
var This=this;
this.isOnline=false;
webpager.enableConn(false);
this.disconnTry.tryAWhile(1000,20000,function(){
_18.log1("\u8fde\u63a5\u72b6\u6001: "+webpager.getConnState());
if(!webpager.getConnState()){
if(save!==false){
This.saveConn(false);
}
return true;
}
});
},saveConn:function(c){
this.connConf=c;
XN.webpager.persistMgr.savethis("c",c?1:0);
},getConnState:function(){
return webpager.getConnState();
},connectFaild:function(){
this.isOnline=false;
this.fireEvent("mgr_connectFaild");
},playSound:function(type){
_18.log1("playSound: \u54d7\u5566\u5566~");
if(webpager.isLocalConnect()){
window.imengine.imHelper.playSound();
}
}};
XN.event.enableCustomEvent(XN.webpager.mgr);
(function(xw){
xw.ChatRoom=function(_1f4){
this.gsps=[];
$extend(this,_1f4);
};
xw.ChatRoom.prototype={notify:true,getId:function(){
throw "method getId must be implemented!";
},serialize:function(){
throw "method serialize must be implemented!";
},unshiftGsp:function(){
},appendGsp:function(){
},pushGsp:function(gsp){
this.gsps.push(gsp);
this.fireEvent("room_gossip_push",gsp);
},replaceGsp:function(_1f6){
this.gsps=_1f6;
this.fireEvent("room_gsp_replace",this.gsps);
},startChat:function(_1f7,_1f8){
this.started=true;
XN.webpager.RoomKeeper.setActive(this,_1f7);
this.fireEvent("room_chat_started",_1f8);
},startConv:function(_1f9,_1fa){
this.startChat(_1f9,_1fa);
},endChat:function(save){
this.disactive(save);
},disactive:function(save){
this.started=false;
XN.webpager.RoomKeeper.cancelActive(this,save);
this.fireEvent("room_chat_disactive");
},destroy:function(save){
var _1fe=XN.webpager.RoomKeeper;
var r=_1fe.room[this.getId()];
if(r){
if(_1fe.activeRoom&&this.getId()==_1fe.activeRoom.getId()){
_1fe.activeRoom=null;
}
this.fireEvent("room_destroy");
if(this.notify===false){
_1fe.hideRoom[this.getId()]=r;
}else{
_1fe.delRoom[this.getId()]=r;
}
delete _1fe.room[this.getId()];
if(save!==false){
_1fe.saveMLayout();
}
}
},isActive:function(){
return XN.webpager.RoomKeeper.activeRoom==this;
},leave:function(){
},loadHistory:function(){
throw "method loadHistory must be implemented!";
},pushSystemMsg:function(){
},broadcast:function(){
}};
xw.AsyncMgr=function(){
this.asyncs=[];
};
$extend(xw.AsyncMgr,{asyncQ:[],qDo:function(fn){
var This=this;
this.asyncQ.push(fn);
var dodo=function(){
clearTimeout(This.qtimer);
if(!This.asyncQ.length){
return;
}
This.doing=true;
var f=This.asyncQ.shift();
f&&f.call(This);
This.qtimer=_12(function(){
This.doing=false;
dodo();
},1000);
};
if(!This.doing){
dodo();
}
}});
xw.AsyncMgr.prototype={doneNum:0,register:function(_204){
this.asyncs.push({t:_204,done:false});
},thisDone:function(_205){
var len=this.asyncs.length;
for(var i=0;i<len;i++){
if(this.asyncs[i].t==_205&&this.asyncs[i].done===false){
this.asyncs[i].done=true;
this.doneNum++;
break;
}
}
if(this.doneNum==len){
this.doneNum=0;
this.asyncs.length=0;
this.fireEvent("asyncMgr_all_done");
}
}};
XN.event.enableCustomEvent(xw.ChatRoom.prototype);
XN.event.enableCustomEvent(xw.AsyncMgr.prototype);
})(XN.webpager);
(function(xw){
xw.RoomKeeper={room:{},delRoom:{},hideRoom:{},building:{},isBackend:{},activeRoom:null,collapseWins:[],init:function(){
this.getCollapseWins();
this.bindEvent();
},bindEvent:function(){
var This=this;
var xw=XN.webpager;
webpager.addEvent("realTime_got",function(n){
var ugc=XN.json.parse(n.content);
if(document.domain=="kaixin.com"&&ugc&&ugc.time<0){
return;
}
var xw=XN.webpager;
if(ugc&&(ugc.ugc_content||ugc.is_at)&&document.domain!="kaixin.com"){
(function(){
var xwnb=XN.webpager.notifyBox;
xwnb.delQ.push(function(){
xwnb.delANotify(ugc.nid,xwnb.makeNotifyUrl(ugc.source,ugc.nid));
});
})();
XN.webpager.tools.log2(42);
_18.log1("new realTIme_got********",n);
XN.webpager.tools.log2(41);
This.throwToUgcRoom(n,ugc);
}else{
if(ugc.source=="10000-1"){
XN.webpager.fireEvent("webpager_notice_got",n);
}else{
This.fireEvent("keeper_notify_got",n);
XN.webpager.fireEvent("webpager_notify_got",n);
}
}
});
webpager.addEvent("message_got",function(m){
This.throwToTwoGuyRoom(m);
});
webpager.addEvent("groupmsg_got",function(m){
This.throwToGroupChat(m);
});
XN.webpager.persistMgr.addEvent("persist_modelStatus_dif",function(_211,_212){
var _map=XN.webpager.friendbook.map;
if(XN.json.build(_map)=="{}"){
XN.webpager.friendbook.getOnlineFriend(false,function(){
This.buildConvs(true,_211,_212);
});
return;
}
This.buildConvs(false,_211,_212);
});
XN.webpager.persistMgr.addEvent("persist_layout_dif",function(){
xw.backLayout();
});
XN.webpager.persistMgr.addEvent("persist_no_models",function(){
This.destroyConvs();
});
XN.webpager.MessagerProxy.addEvent("proxy_send_back",function(n){
n.time=XN.webpager.tools.getTime();
var conv=This.room[n.touin];
conv.unshiftReply(n);
});
},makeBackEndGroupRoom:function(_216,_217){
var str=XN.webpager.persistMgr.getWpiCookieBy("wp_save");
if(str&&str.indexOf(_216+"_"+_217)!=-1){
return;
}
var rm=this.makeGroupRoom({roomId:_216,roomName:_217},false,null,true);
},getCollapseWins:function(){
var ids=webpager.getItem("webpager_ui_collapse_wins");
if(ids){
this.collapseWins=ids.split(",");
}
},isCollapse:function(id){
for(var i=0;i<this.collapseWins.length;i++){
if(this.collapseWins[i]==id){
return true;
}
}
return false;
},getStatus:function(id){
var m=XN.webpager.friendbook.map[id];
return m?m.status:2;
},saveCollapse:function(id){
if(!this.isCollapse(id)){
this.collapseWins.push(id);
webpager.setItem("webpager_ui_collapse_wins",this.collapseWins.join(","));
}
},unsaveCollapse:function(id){
for(var i=0;i<this.collapseWins.length;i++){
if(this.collapseWins[i]==id){
this.collapseWins.splice(i,1);
webpager.setItem("webpager_ui_collapse_wins",this.collapseWins.join(","));
}
}
},parseType:function(_222){
return parseInt(_222.substring(_222.lastIndexOf(".")+1));
},parseId:function(_223){
var type=this.parseType(_223);
switch(type){
case 1:
case 3:
return _223.substring(0,_223.lastIndexOf("_"));
case 2:
return _223.substring(0,_223.lastIndexOf("."));
}
},parseName:function(_225){
var type=this.parseType(_225);
switch(type){
case 1:
case 3:
return _225.substring(_225.lastIndexOf("_")+1,_225.lastIndexOf("."));
}
},findConv:function(_227,_228){
_18.log1("\u67e5\u627e\u7684userObj\u662f:");
_18.log1(_227);
if(!_227){
return;
}
var conv=this.room[_227.id];
if(!conv){
_18.log1("\u8981\u67e5\u627e\u7684conv\u6ca1\u6709\u6253\u5f00, \u65b0\u5efa\u4e00\u4e2a!");
conv=this.doAddConv(_227,true,1);
_18.log1("\u7ecf\u8fc7\u65b0\u5efa, \u5f97\u5230\u7684conv\u662f:");
_18.log1(conv);
}
if(_228!==false){
conv.startConv();
}else{
}
return conv;
},isConvAva:function(f_id){
return !!XN.webpager.friendbook.map[f_id];
},addConv:function(_22b,save){
var _22d=this.parseType(_22b.label);
var _22e=_22b.label.substring(0,_22b.label.lastIndexOf(".")),_22f=_22e.split("_");
switch(_22d){
case 2:
_22b.feed_actor=_22f[0];
_22b.feed_source=_22f[1];
_22b.feed_stype=_22f[2];
break;
case 3:
_22b.roomId=_22f[0];
_22b.roomName=_22f[1];
break;
}
return this.doAddConv(_22b,save,_22d,undefined,true);
},doAddConv:function(_230,save,_232,_233,_234){
if(!_230){
return;
}
var conv=this.room[_230.id];
var _236=this.delRoom[_230.id];
if(conv){
return this.room[_230.id];
}
var _237;
if(_236){
_237=_236;
if(_237.notify){
this.room[_230.id]=_237;
if(save!==false){
this.saveMLayout();
}
XN.webpager.tasks.prepareWinFor(_236);
}else{
this.hideRoom[_230.id]=_237;
}
return _237;
}else{
if(_232==1){
_237=new XN.webpager.TwoGuyChatRoom({f_id:_230.id,f_name:_230.name,replies:[]});
this.room[_230.id]=_237;
var c=new XN.webpager.convWindow({name:_230.name,head:_230.tiny,status:_230.status,renc_status:_230.doing,replies:[],model:_237});
XN.webpager.tasks.add(c);
}else{
if(_232==2){
if(!_237){
_237=this.makeRoom({id:_230.id,f_id:_230.id,r_id:_230.id,source:_230.feed_source,type:_230.feed_stype},{feed_actor:_230.feed_actor,feed_source:_230.feed_source,feed_stype:_230.feed_stype,type:_230.feed_stype},false,false);
}
}else{
if(_232==3){
_237=this.getRoom(_230.roomId);
if(!_237){
_237=this.buildGroupRoom({roomId:_230.roomId,roomName:_230.roomName,isCollapse:this.isCollapse(_230.roomId)},save,_233,_230.gspFire,_234);
}
}
}
}
}
if(save){
this.saveMLayout();
}
return _237;
},destroyConvs:function(){
var sta=XN.webpager.initModelStatus;
XN.array.each(this.room,function(i,room){
room.destroy(false);
});
},buildConvs:function(_23c,_23d,_23e){
var This=this;
var _map=XN.webpager.friendbook.map;
var sta=XN.webpager.initModelStatus;
var _242=XN.webpager.persistMgr.saveObj;
var _243=XN.json.parse(XN.webpager.persistMgr.preModelStatus);
if(sta&&sta.conv&&sta.conv.models===""){
this.destroyConvs(false);
return;
}
if(sta.conv&&sta.conv.models!==undefined&&sta.conv.models!==""){
var _244=sta.conv.activeModelId;
var ids=sta.conv.models.split(",");
var _246;
if(_243&&_243.conv){
_246=_243.conv.models.split(",");
}else{
_246=[];
}
var _247;
var _248;
var _249={};
if(_246.length>ids.length){
_247=_246;
_248=ids;
}else{
_247=ids;
_248=_246;
}
XN.array.each(_247,function(i,id){
_249[_247[i]]=true;
if(_248[i]){
_249[_248[i]]=true;
}
});
XN.array.each(_249,function(i,_24d){
if(_24d!==true){
return;
}
var m_id=This.parseId(i);
var temp=XN.webpager.friendbook.map[m_id];
var _250=i.split("_");
if(!temp){
_18.log1(m_id+" \u7528\u8fd9\u4e2aid\u53d6\u4e0d\u5230\u597d\u53cb");
temp={id:m_id,label:i,name:This.parseName(i)};
}
temp.label=i;
if(This.isInAry(i,ids)){
temp=This.addConv(temp,false);
if(temp.getId&&sta.conv.activeModelId==temp.getId()){
_12(function(){
temp.startConv(false,_23c===true?undefined:false);
},1500);
}
}else{
if(This.parseType(i)=="ChatRoom"){
This.room[i]&&This.room[i].destroy();
}else{
if(This.room&&This.room[m_id]){
This.room[m_id].destroy();
}
}
}
});
if(_23e&&_23e.conv){
var _251=this.room[_23e.conv.activeModelId];
if(_251&&_23d.conv.activeModelId==null){
window.room=_251;
_251&&_251.disactive(false);
}
}
}
},isInAry:function(ele,ary){
var ret=false;
for(index in ary){
if(ary[index]==ele){
return true;
}
}
return ret;
},throwToTwoGuyRoom:function(_255){
var This=this;
var wp=XN.webpager;
var _258;
_18.log1("^^^^^^^\u6536\u5230\u65b0\u5355\u804a\u6d88\u606f");
_18.log1(_255);
var p={id:_255.fromuin,name:_255.fromname,content:_255.msg_content};
_258=_255.fromuin;
if(wp.isHost(_255.fromuin)){
_258=_255.touin;
p.id=_258;
}
var fri=XN.webpager.friendbook.map[_258];
var conv=this.room[_258];
if(!conv){
p.status=This.getStatus(_258);
if(fri){
p.tiny=fri.tiny;
p.name=fri.name;
}
conv=this.doAddConv(p,true,1);
}
_255.time=XN.webpager.tools.getTime();
try{
if(!fri){
XN.webpager.friendbook.getUserInfo(_258,function(obj){
conv.updateProfile({id:_258,tiny:obj[_258].head,name:obj[_258].name,status:2});
conv.unshiftReply(_255);
});
}else{
conv.unshiftReply(_255);
}
}
catch(e){
XN.webpager.tools.logExpt("c01",e);
}
},throwToUgcRoom:function(_25d,ugc){
try{
_18.log1("\u6536\u5230\u6d88\u606f, \u6d88\u606f\u5185\u5bb9\u662f: "+ugc.ugc_content);
_25d.id=ugc.feed_actor+"_"+ugc.feed_source+"_"+ugc.feed_stype;
_25d.source=ugc.feed_source;
_25d.f_id=_25d.id;
_25d.r_id=_25d.id;
_25d.icon=ugc.icon;
var xw=XN.webpager;
var rm=this.room[_25d.r_id];
if(rm&&rm.x&&ugc.time<0){
_18.log1("time\u5c0f\u4e8e0\u4e86 "+"gossip not for me(time<0&&x==true), throw it!");
return;
}
var gsp=XN.json.parse(_25d.content);
if(gsp){
gsp.isHost=xw.isHost(ugc.from_id);
gsp.timestamp=_25d.timestamp||new Date().getTime();
}
_262(gsp,rm,_25d,ugc);
}
catch(e){
if(XN.webpager.debug){
alert(e);
}
XN.webpager.tools.logExpt("c02",e);
}
},throwToGroupChat:function(m){
var This=this;
try{
var temp=XN.json.parse(m.content),info=temp.info,type=temp.type,_268={};
if(this.isRoomBuilding(info.roomid)){
return;
}
var rm=this.room[info.roomid];
_268.roomId=info.roomid;
_268.roomName=info.roomname;
if(!rm){
if(type!="groupchat"&&type!="settingchange"){
return;
}
rm=this.hideRoom[info.roomid];
if(!rm||rm.notify){
_268.id=_268.roomId;
_268.gspFire=true;
rm=this.doAddConv(_268,true,3);
}
}
if(!rm){
return;
}
rm.ready(function(){
switch(type){
case "groupchat":
var _26a=rm.getAttendee(info.userid);
var gsp={tiny:_26a.tiny,id:info.userid,name:_26a.name,timestamp:new Date().getTime(),message:temp.chat};
rm.pushGsp(gsp);
This.fireEvent("keeper_gsp_got",rm);
if(rm.roomName!=info.roomname){
rm.fireEvent("groupChat_name_changed",info.roomname);
}
break;
case "entergroup":
rm.pushAttendee({id:info.userid,name:temp.name,tiny:temp.tiny});
break;
case "leftgroup":
if(temp.status=="0"){
rm.delAttendee(info.userid);
}
break;
case "exitgroup":
rm.disable();
break;
case "settingchange":
rm.notify=temp.set=="0";
break;
}
});
return rm;
}
catch(e){
if(XN.webpager.debug){
alert(e);
}
XN.webpager.tools.logExpt("c03",e);
}
},isRoomBuilding:function(_26c){
return this.building[_26c];
},parseInfo:function(str){
var regx=/(\d+)_([^@]+)@([^\/]+)\/([^-\/]+)\(\d+\)-(\d+)/;
var ret=regx.exec(str);
if(!ret){
return {};
}
return {roomId:ret[1],roomName:ret[2],userId:ret[5],userName:ret[4]};
},buildGroupRoom:function(_270,save,hide,_273,_274){
var rm;
rm=this.makeGroupRoom(_270,save,function(){
if(_274){
var skin=new XN.webpager.GroupWindow({model:rm,gspFire:_273});
XN.webpager.tasks.add(skin);
}else{
if(rm.notify){
var skin=new XN.webpager.GroupWindow({model:rm,gspFire:_273});
XN.webpager.tasks.add(skin);
}
}
},hide,_273);
return rm;
},buildGroupRoom2:function(rm,save,fn){
var _27a=XN.webpager.tasks;
var skin=_27a.getWin(rm.getId());
if(!skin){
skin=new XN.webpager.GroupWindow({model:rm});
}
this.room[rm.getId()]=rm;
if(this.hideRoom[rm.getId()]){
delete this.hideRoom[rm.getId()];
}
XN.webpager.tasks.add(skin);
if(fn){
fn.call(this);
}
if(save){
this.saveMLayout();
}
return rm;
},putInShow:function(rm){
var id=rm.getId();
if(this.hideRoom[id]){
delete this.hideRoom[id];
}
if(this.delRoom[id]){
delete this.delRoom[id];
}
this.room[rm.getId()]=rm;
},makeGroupRoom:function(obj,save,fn,hide,_282){
var This=this;
this.building[obj.roomId]=true;
var _obj={};
$extend(_obj,obj);
$extend(_obj,{onReady:function(){
window.chatRoom=_285;
if(hide){
This.hideRoom[_285.getId()]=_285;
}else{
if(_282&&(!_285.notify)){
This.hideRoom[_285.getId()]=_285;
}else{
This.putInShow(_285);
}
}
This.building[_285.getId()]=false;
if(fn){
fn.call(This);
}
if(save!==false){
This.saveMLayout();
}
},gspFire:_282});
var _285=new XN.webpager.GroupChatRoom(_obj);
return _285;
},getUgcRoomId:function(o){
return o.feed_actor+"_"+o.feed_source+"_"+o.feed_stype;
},addRoom:function(_287,ugc,_289,save){
var rm;
var This=this;
rm=this.room[this.getUgcRoomId(_287)];
if(!rm){
rm=new XN.webpager.UgcChatRoom(_287,ugc);
this.room[rm.getId()]=rm;
}
return rm;
},makeRoom:function(obj,ugc){
var This=this;
var rm=this.addRoom(obj,ugc);
rm.addEvent("ugcroom_topic_got",function(_291){
if(!_291){
rm.destroy();
return;
}
XN.webpager.tasks.add(rm.skin);
rm.skin.ready=true;
rm.fireEvent("room_skin_ready");
ugc.entity=_291;
ugc.type=ugc.type||msgObj.type;
rm.ugc=ugc;
rm.skin.upUgc(ugc,false);
rm.skin.element.style.visibility="visible";
rm.loadHistory(ugc);
});
rm.skin=This.makeSkin(rm,rm.ugc,false,false);
rm.asyncloadTopic();
this.room[rm.getId()]=rm;
return rm;
},getRoom:function(_292){
return this.room[_292];
},makeSkin:function(room,ugc,_295,save,fn){
try{
var This=this;
var _299=parseInt(ugc.feed_stype);
switch(_299){
case 502:
var skin=new XN.webpager.UgcWindow({skinType:_299,strButton:"",strTitle:"",model:room});
break;
case 701:
case 708:
case 709:
var skin=new XN.webpager.PhotoWindow({skinType:_299,strButton:"",strTitle:"",model:room});
break;
case 5030:
case 110:
var skin=new XN.webpager.ShareWindow({skinType:_299,strButton:"",strTitle:"",model:room});
break;
case 103:
var skin=new XN.webpager.PhotoShareWindow({skinType:_299,strButton:"",strTitle:"",model:room});
break;
}
if(!skin){
return;
}
skin.element.style.visibility="hidden";
if(save!==false){
this.saveMLayout(room,ugc);
}
if(fn){
fn.call(This);
}
return skin;
}
catch(e){
alert(e);
XN.webpager.tools.logExpt("c04",e);
}
},setActive:function(room,_29c){
this.activeRoom=room;
if(_29c===false){
return;
}
this.saveMLayout();
},cancelActive:function(room,save){
this.activeRoom=null;
if(save===false){
return;
}
this.saveMLayout();
},saveMLayout:function(room,ugc){
XN.webpager.persistMgr.save("conv",{activeModelId:this.activeRoom?this.activeRoom.getId():null,models:this.room});
}};
var _2a1=xw.RoomKeeper;
var _262=function(gsp,rm,_2a4,ugc){
if(!rm){
rm=_2a1.addRoom(_2a4,ugc);
_2a4.feed_actor=ugc.feed_actor;
_2a4.feed_source=ugc.feed_source;
_2a4.feed_stype=ugc.feed_stype;
rm.addEvent("room_gsp_replace",function(){
if(!gsp.is_at){
rm&&rm.appendGsp(gsp,ugc);
}
rm.delEvent("room_gsp_replace",arguments.callee);
});
rm.addEvent("ugcroom_topic_got",function(_2a6){
if(!_2a6){
rm.destroy();
return;
}
rm.skin.beforeThis=rm.getId();
XN.webpager.tasks.add(rm.skin);
rm.skin.ready=true;
rm.fireEvent("room_skin_ready");
ugc.entity=_2a6;
ugc.type=ugc.type||_2a4.type;
rm.ugc=ugc;
rm.skin.upUgc(ugc);
rm.skin.element.style.visibility="visible";
rm.loadHistory(ugc);
});
rm.skin=_2a1.makeSkin(rm,rm.ugc);
rm.asyncloadTopic();
}else{
if(gsp.is_at){
return;
}
rm=_2a1.getRoom(_2a4.r_id);
if(rm.skin&&rm.skin.ready){
rm.pushGsp(gsp,ugc);
}else{
rm.addEvent("room_gsp_replace",function(){
rm&&rm.appendGsp(gsp,ugc);
rm.delEvent("room_gsp_replace",arguments.callee);
});
}
}
};
XN.event.enableCustomEvent(XN.webpager.RoomKeeper);
})(XN.webpager);
XN.webpager.convWindow=function(_2a7){
this.model=_2a7.model;
_2a7.tag="conv";
$extend(this,_2a7);
this.init(_2a7);
window.test=this;
};
extendClass(XN.webpager.convWindow,XN.webpager.abstractWindow);
$extend(XN.webpager.convWindow.prototype,{_modelFns:{},getWidth:function(){
return this.element.offsetWidth;
},show:function(_2a8){
var This=this;
XN.webpager.convWindow.superClass.show.apply(this,arguments);
this.active=true;
if(_2a8!==false){
this.element.getElementsByTagName("textarea")[0].focus();
}
This.article.style.width="290px";
This.header.style.width="290px";
This.article.style.zoom=1.1;
This.article.style.zoom=1;
this.myGroup.fireEvent("view_a_window_actived");
},getDefaultOptions:function(){
this.canMaxTitle="\u67e5\u770b\u7559\u8a00\u8bb0\u5f55";
var _2aa=XN.webpager.friendsWindow.superClass.getDefaultOptions.call(this);
return $extend(_2aa,{canClose:true,canMax:true});
},getButton:function(){
var _2ab=XN.webpager.parseStatus(this.options.status);
return ["<img class=\"icon\" height=\"16\" width=\"16\" src=\"http://a.xnimg.cn/n/core/res/webpager/chat-icon.gif\" />"," <strong class=\"title\">"+XN.webpager.tools.noMoreThan(this.options.name,5)+"</strong>","<img ie6src=\""+_2ab.icon_toread_ie6+"\" title=\"",_2ab.online,"\" src=\"",_2ab.icon,"\"/>"].join("");
},getHeader:function(){
if(!(this.options.head)){
var m=this.options.model;
XN.webpager.friendbook.getUserInfo(m.getId(),function(o){
m.updateProfile({id:m.getId(),tiny:o[m.getId()].head,name:o[m.getId()].name});
});
}
return ["<figure>","<a href=\"http://www."+XN.env.domain+"/profile.do?id="+this.options.model.f_id+"\" target=\"_blank\"><img height=\"50\" width=\"50\" src=\""+(this.options.head||XN.webpager.url.OFFLINE_IMG)+"\"/></a>","</figure>","<h4>",XN.webpager.showNotice?"\u4f60\u548c"+this.options.name+"\u7684\u7559\u8a00\u677f":this.options.name,"</h4>","<h5 class=\"subheading\"> ","</h5>"].join("");
},getContent:function(){
var _2ae=["<div class=\"dialog hbox\">","<div class=\"dialogs hbox\">","<article class=\"system-notification\"><img class=\"icon\" src=\""+XN.webpager.url.WPI_BULB+"\" alt=\"\u901a\u77e5\" />"+XN.webpager.msg.NOTICE+"<a href=\"#\" class=\"x-closelink\">\u5173\u95ed</a></article>","<article class=\"dialogs gspList\">",this.getMessage(),"</article>","</div>","<div class=\"editor hbox\">","<form class=\"editor\" action=\"\" method=\"post\">","<div class=\"toolbar\" style=\"display:none;\">","<ul class=\"main\">","<li><a class=\"button\" title=\"\u8868\u60c5\" href=\"#nogo\"><img src=\"http://a.xnimg.cn/imgpro/icons/statusface/1.gif?ver=1\" /></a></li>","</ul>","<ul class=\"emotion\">","<li><a href=\"#nogo\"><img src=\"http://a.xnimg.cn/imgpro/icons/statusface/16.gif?ver=1\" title=\"\u5927\u7b11\" alt=\"\u5927\u7b11\" emotion=\"(\u5927\u7b11)\"/></a></li><li><a href=\"#nogo\"><img emotion=\"(\u5fae\u7b11)\" alt=\"\u5fae\u7b11\" title=\"\u5fae\u7b11\" src=\"http://a.xnimg.cn/imgpro/icons/statusface/1.gif?ver=1\" /></a></li>","</ul>","<ul class=\"alt\">","<li>","<label><input type=\"checkbox\" /> \u6084\u6084\u8bdd</label>","</li>","</ul>","</div>","<textarea></textarea>","<input type=\"image\" src=\"http://a.xnimg.cn/n/core/res/webpager/send-button.png\" />","</form>","</div>","</div>"].join("");
return _2ae;
},makeSection:function(obj){
var _2b0=[];
if(obj.fromuin==XN.webpager.User.id){
srcHead=XN.webpager.User.head;
}else{
try{
srcHead=XN.webpager.friendbook.getTiny(obj.fromuin);
}
catch(e){
XN.webpager.tools.logExpt("c12",e);
}
}
_2b0.push("<section>","<figure class=\"avatar\">",obj.type!="system"?"<img width=\"35\" height=\"35\" src=\""+srcHead+"\" />":"","</figure>","<header>","<span class=\"user\">","<a target=\"_blank\" href=\"http://www."+XN.env.domain+"/profile.do?id="+obj.fromuin+"\">",obj.fromname,"</a>","</span>","<span class=\"time\">",obj.time,"</span>","</header>","<section>","<p>",obj.type=="system"?obj.msg_content:XN.webpager.tools.htmlFilter(obj.msg_content),"</p>","</section>","<footer>","</footer>","</section>");
return _2b0.join("");
},xAddEvent:function(){
XN.log("[convWindow.prototype.xAddEvent] binding event");
var This=this;
function sendAction(){
if(XN.string.trim(This.inputHelper.getRealValue())){
var p={name:XN.webpager.User.name,head:XN.webpager.User.head,msg_content:This.inputHelper.getRealValue(),time:XN.webpager.tools.getTime()};
var ret=This.options.model.checkContent(p.msg_content);
if(!ret.isOK){
This.options.model.showSystemMsg(ret.msg);
return;
}
This.options.model.sendConv(p);
This.input.value="";
}
This.input.blur();
_12(function(){
This.input.focus();
},10);
}
function fuckIE6(evt){
var s=XN.webpager.parseStatus(This.options.status);
var o=This.button.getElementsByTagName("img")[1];
if(evt=="view_window_active"){
o.src=s.icon;
}else{
if(evt=="conv_replies_unshift"){
if(XN.browser.IE6){
o&&(o.src=s.icon_toread_ie6);
}
}
}
}
this.input.addEvent("keydown",function(e){
e=e||window.event;
if(e.keyCode==13){
sendAction();
}
if(e.ctrlKey&&e.keyCode==69){
if(This.model.isActive()){
This.model.destroy();
}
}
});
this.sendBtn.addEvent("click",function(e){
sendAction();
XN.event.stop(e);
});
this.addEvent("ua_open_window",function(){
XN.webpager.tools.log("http://track.yx.renren.com/statmop/dfa1?dfaid=8063");
This.model.startConv();
This.element.delClass("toread");
});
this.addEvent("view_window_active",function(){
This.active=true;
XN.webpager.BlingMgr.titleBling.stop();
fuckIE6("view_window_active");
});
this.addEvent("view_window_disactive",function(){
This.active=false;
This.model.disactive();
});
this.addEvent("view_window_added",function(){
});
this.addEvent("view_window_close",function(){
XN.webpager.BlingMgr.titleBling.stop();
try{
This.model.destroy();
}
catch(e){
_18.log1(e);
XN.webpager.tools.logExpt("c13",e);
}
});
this.addEvent("view_before_show",function(){
});
this.addEvent("view_after_show",function(){
This.gspListScrollBtm();
});
this.addEvent("view_window_maximize",function(){
window.open("http://gossip."+XN.env.domain+"/getgossiplist.do?id="+XN.webpager.User.id+"&f="+This.model.f_id,"_blank");
});
this.noticeClose.onclick=function(){
This.hideNotice();
XN.webpager.persistMgr.setWpiCookie("nr",1,360);
};
this.addModelEvent("conv_replies_unshift",function(conv){
try{
if(conv.fromuin!=XN.webpager.User.id){
if(!This.model.isActive()||!This.active){
if(webpager.isLocalConnect()){
XN.webpager.BlingMgr.titleBling.start();
}
This.hlight();
}
}
This.addAConv(conv);
if(conv.fromuin!=XN.webpager.User.id){
if(!XN.webpager.persistMgr.getWpiCookieBy("rtg")){
XN.webpager.persistMgr.setWpiCookie("rtg","1",360);
}
}
}
catch(e){
_18.log1(e);
XN.webpager.tools.logExpt("c14",e);
}
});
this.addModelEvent("conv_replies_replace",function(conv){
This.updateGspList();
});
this.addModelEvent("room_destroy",function(msg){
This.destroy();
});
this.addModelEvent("conv_conv_started",function(_2bc){
XN.webpager.BlingMgr.titleBling.stop();
This.element.delClass("toread");
if(!This.active){
This.show(_2bc);
}
This.showNotice();
});
this.addModelEvent("conv_status_disactive",function(){
This.hide(false);
});
this.addModelEvent("conv_profile_updated",function(_2bd){
This.updateHead(_2bd.tiny);
});
this.addModelEvent("room_chat_disactive",function(_2be){
This.hide(false);
});
var _2bf=false;
this.addModelEvent("conv_conv_offline",function(){
if(!_2bf){
_2bf=true;
This.addAConv({time:XN.webpager.tools.getTime(),fromname:"",type:"system",msg_content:"<p style=\"color:#666;\">\u8be5\u7528\u6237\u76ee\u524d\u4e0d\u5728\u7ebf\uff0c\u53ef\u80fd\u65e0\u6cd5\u9a6c\u4e0a\u56de\u590d\u4f60</p>"});
}
});
},hlight:function(){
this.element.addClass("toread");
if(XN.browser.IE6){
var s=this.statusIcon.src;
this.statusIcon.src=s.substring(0,s.lastIndexOf("_")+1)+"ie6.gif";
}
},disHlight:function(){
this.element.delClass("toread");
if(XN.browser.IE6){
var s=this.statusIcon.src;
this.statusIcon.src=s.substring(0,s.lastIndexOf("_")+1)+"std.png";
}
},xinit:function(){
this.inputHelper=new XN.form.inputHelper(this.input);
},getMessage:function(){
var _2c2=[];
var _2c3=this.model.replies;
for(var i=0;i<_2c3.length;i++){
_2c2.unshift(this.makeSection(_2c3[i]));
}
return _2c2.join("");
},showNotice:function(){
var nr=XN.webpager.persistMgr.getWpiCookieBy("nr");
if(nr||!XN.webpager.showNotice){
this.notice.hide();
}else{
this.notice.show();
}
},hideNotice:function(){
this.notice.hide();
XN.webpager.showNotice=false;
},getUIRef:function(){
this.input=this.element.getElementsByTagName("textarea")[0];
this.section=this.element.getElementsByTagName("section")[0];
this.article=this.element.getElementsByTagName("article")[0];
this.header=this.element.getElementsByTagName("header")[0];
this.form=this.element.getElementsByTagName("form")[0];
var _2c6=this.form.getElementsByTagName("input");
this.sendBtn=$(_2c6[_2c6.length-1]);
this.figure=this.element.getElementsByTagName("figure")[0];
this.headImg=this.figure.getElementsByTagName("img")[0];
this.btn=this.element.getElementsByTagName("div")[0];
this.statusIcon=this.btn.getElementsByTagName("img")[1];
this.gspList=$(Sizzle("article.gspList",this.element)[0]);
this.notice=$(Sizzle("article.system-notification",this.element)[0]);
this.noticeClose=$(Sizzle("a.x-closelink",this.notice)[0]);
var cs=this.section.childNodes;
var _2c8=312;
},UIPrepare:function(){
var This=this;
var n=XN.webpager.notice.winAD2;
if(n&&n.isAvailable()){
if(this.gspList){
n.ready(function(){
var m=n.makeElement(2);
$(This.gspList.parentNode).appendChild(m,This.gspList);
n.bindEvent(m);
});
}
}
},updateGspList:function(){
this.gspList.innerHTML+=this.getMessage();
this.gspListScrollBtm();
},updateHead:function(tiny){
this.headImg.src=tiny;
},updateStatus:function(obj){
var sta=XN.webpager.parseStatus(obj.status);
this.statusIcon.src=sta.icon;
},gspListScrollBtm:function(){
this.gspList.scrollTop=this.gspList.scrollHeight;
},update:function(){
this.updateGspList();
},addAConv:function(conv){
if(XN.browser.IE){
try{
this.gspList.appendChild(XN.webpager.tools.getDom(this.makeSection(conv)));
}
catch(e){
_18.log1("addAConv\u7684\u65f6\u5019\u53d1\u751f\u5f02\u5e38!");
_18.log1(e);
XN.webpager.tools.logExpt("c15",e);
}
}else{
this.gspList.appendChild($make(this.makeSection(conv)));
}
this.gspListScrollBtm();
},showConv:function(f_id){
},isInStack:function(){
return XN.webpager.winSlider.isInStack(this);
},addModelEvent:function(_2d1,fn){
if(!this._modelFns[_2d1]){
this._modelFns[_2d1]=[];
}
this._modelFns[_2d1].push(fn);
this.model.addEvent(_2d1,fn);
},destroy:function(){
this.remove();
}});
(function(xw){
xw.TwoGuyChatRoom=function(_2d4){
xw.ChatRoom.call(this,_2d4);
};
$extend(xw.TwoGuyChatRoom.prototype,xw.ChatRoom.prototype);
$extend(xw.TwoGuyChatRoom.prototype,{superPro:xw.ChatRoom.prototype,replies:[],getId:function(){
return this.f_id;
},serialize:function(){
return this.f_id+"_"+this.f_name+".1";
},loadHistory:function(f_id){
var ret=this.getMessageHistory(f_id);
this.replaceReplies(ret);
},getMessageHistory:function(f_id){
var ret=XN.webpager.MessagerProxy.getMessageHistory(f_id);
return ret;
},startChat:function(_2d9,_2da){
this.started=true;
XN.webpager.RoomKeeper.setActive(this,_2d9);
if(!this.replies||!(this.replies.length)){
this.loadHistory(this.f_id);
this.fireEvent("conv_history_loaded");
}
this.fireEvent("conv_conv_started",_2da);
},startConv:function(_2db,_2dc){
this.startChat(_2db,_2dc);
},replaceReplies:function(rs){
this.replies=rs;
this.fireEvent("conv_replies_replace",rs);
},broadcast:function(conv){
this.fireEvent("conv_before_send",conv);
conv.msg_content=XN.webpager.tools.htmlFilter(conv.msg_content);
conv.fromuin=XN.webpager.User.id;
conv.fromname=XN.webpager.User.name;
conv.touin=this.f_id;
conv.msg_content=XN.webpager.tools.unescapeHTML(conv.msg_content);
webpager.sendMessage(conv);
if(!XN.webpager.RoomKeeper.isConvAva(this.f_id)){
this.fireEvent("conv_conv_offline");
}
},sendConv:function(conv){
this.broadcast(conv);
},checkContent:function(str){
if(str.length>2000){
return {isOK:false,msg:XN.webpager.msg.TOO_LONG};
}
return {isOK:true,msg:"sus"};
},unshiftReply:function(conv){
this.replies.unshift(conv);
this.fireEvent("conv_replies_unshift",conv);
},htmlFilter:function(str){
str=str.replace(/</g,"&lt;");
str=str.replace(/>/g,"&gt;");
return str;
},showSystemMsg:function(msg){
var p={fromname:"",head:XN.webpager.User.head,msg_content:msg,time:XN.webpager.tools.getTime(),type:"system"};
this.unshiftReply(p);
},updateProfile:function(obj){
var o=XN.webpager.friendbook.map[this.f_id]||{};
$extend(o,obj);
XN.webpager.friendbook.map[obj.id]=o;
this.fireEvent("conv_profile_updated",o);
},getMyInfo:function(){
var This=this;
XN.webpager.getUserInfo(this.f_id,function(info,r){
This.fireEvent("conv_my_info_got",info);
});
}});
})(XN.webpager);
XN.webpager.GroupWindow=function(_2ea){
$extend(this,_2ea);
this.init(_2ea);
this.tag="conv";
$(this.element).addClass("popupwindow");
};
$extend(XN.webpager.GroupWindow.prototype,XN.webpager.abstractWindow.prototype);
XN.webpager.GroupWindow.superPro=XN.webpager.abstractWindow.prototype;
$extend(XN.webpager.GroupWindow.prototype,{getButton:function(){
var tls=XN.webpager.tools;
return "<img class=\"icon\" src=\"http://s.xnimg.cn/n/apps/minigroup/img/default-icon.png\"/> <strong title=\""+this.model.roomName+"\" class=\"title\">"+tls.noMoreThan(this.model.roomName,5)+"</strong>";
},getHeader:function(){
return ["<h4>",XN.webpager.tools.noMoreThan(this.model.roomName,14),"</h4>"].join("");
},getContent:function(){
var _2ec=["<div class=\"box\">","<div class=\"members vbox\">","<article class=\"members\">","<header>","<h4>\u5f53\u524d\u5728\u7ebf\uff1a</h4>","</header>","<section>",this.makeAtendeeList(this.model.attendee),"</section>","</article>","</div>","<div class=\"collapsetrigger\"",XN.browser.IE6?" style=\"display:none\"":"","><a class=\"right\" href=\"javascript:;\"></a></div>","<div class=\"dialog vbox\">","<div class=\"dialogs hbox\">","<article class=\"dialogs gspList\">",this.makeHistory(this.model.gsps),"</article>","</div>","<div class=\"editor hbox\">","<form class=\"editor\" action=\"\" method=\"post\">","<textarea></textarea>","<input type=\"image\" src=\"http://a.xnimg.cn/n/core/res/webpager/send-button.png\" />","</form>","</div>","</div>","</div>"].join("");
return _2ec;
},getUIRef:function(){
window.chatRoomSkin=this;
this.onlineList=$(Sizzle("article.members section",this.element)[0]);
this.input=$(Sizzle("form textarea",chatRoomSkin.element)[0]);
this.btn=$(Sizzle("form textarea~input",chatRoomSkin.element)[0]);
this.popWin=this.element.getElementsByTagName("article")[0];
this.gspList=$(Sizzle("article.dialogs",this.element)[0]);
this.trigger=$(Sizzle(".collapsetrigger",chatRoomSkin.element)[0]);
this.trigger_a=$(Sizzle("a",this.trigger)[0]);
this.onlineListBox=$(Sizzle("div.members",chatRoomSkin.element)[0]);
this.title=$(Sizzle("h4",this.element)[0]);
this.btnTitle=$(Sizzle("strong",this.element)[0]);
this.popWin.style.width="425px";
},xinit:function(){
if(this.model.isCollapse){
this.closeList();
}
if(this.gspFire){
this.showHlight();
}
},xAddEvent:function(){
var This=this;
var _2ee=this.model;
var send=function(){
var str=This.input.value;
if(XN.string.trim(str)){
if(str.length>500){
This.addAGsp({userId:"",tinyurl:"",timestamp:new Date().getTime(),userName:"\u7cfb\u7edf\u6d88\u606f",content:"\u867d\u7136\u4f60\u6709\u5343\u8a00\u4e07\u8bed\uff0c\u4f46\u8fd8\u662f\u957f\u8bdd\u77ed\u8bf4\u5427(500\u5b57\u5185)^_^",type:"system"});
This.input.blur();
_12(function(){
This.input.focus();
},100);
return;
}
str=XN.webpager.tools.filter(str);
This.model.broadcast(str);
}
This.input.blur();
_12(function(){
This.input.value="";
This.input.focus();
},100);
};
this.btn.addEvent("click",function(e){
e=e||window.event;
XN.event.stop(e);
send();
});
this.input.addEvent("keydown",function(e){
e=e||window.event;
if(e.keyCode==13){
send();
}
if(e.ctrlKey&&e.keyCode==69){
if(This.model.isActive()){
This.model.destroy();
}
}
});
this.trigger.addEvent("click",function(e){
e=e||window.event;
if(!This.trigger.getAttribute("close")){
This.closeList();
}else{
This.openList();
}
Sizzle("a",This.trigger)[0].blur();
This.input.focus();
});
this.onlineList.addEvent("click",function(e){
e=e||window.event;
});
this.addEvent("ua_open_window",function(){
This.model.startChat(true);
This.input.focus();
});
this.addEvent("ua_collapse_window",function(){
This.model.endChat(true);
});
this.addEvent("view_window_close",function(){
This.model.destroy();
});
this.addEvent("view_window_disactive",function(){
This.model.endChat(true);
});
this.addModelEvent("grouproom_attendee_replace",function(_2f5){
This.buildAttendee(_2f5);
});
this.addModelEvent("groupChat_attendee_push",function(_2f6){
This.appendAttendee(_2f6);
});
this.addModelEvent("groupChat_attendee_del",function(_2f7){
This.delAttendee(_2f7);
});
this.addModelEvent("groupChat_disble",function(msg){
This.disable(msg);
});
this.addModelEvent("room_gossip_push",function(gsp){
if(This.model.notify){
if(!This.active){
This.showHlight();
}else{
XN.webpager.notifyBox.delAll(This.model.source);
}
if(!(gsp.userId==XN.user.id)){
XN.webpager.mgr.playSound();
}
}
This.addAGsp(gsp);
});
this.addModelEvent("room_chat_started",function(_2fa){
This.delHlight();
This.show(_2fa);
if(_2fa){
This.input.focus();
}
if(!This.lastScrollHeight){
This.lastScrollHeight=This.gspList.scrollHeight;
This.lastScrollTop=This.gspList.scrollTop;
This.initScrl_h=This.gspList.scrollHeight;
}
if(!_2ee.notify){
if(!this.hasBeenStart){
This.renderHistory(_2ee.gsps);
this.hasBeenStart=true;
}
}
This.gspListScrollBtm(false);
});
this.addModelEvent("room_chat_disactive",function(_2fb){
This.hide(false);
});
this.addModelEvent("room_destroy",function(msg){
This.destroy();
_12(function(){
XN.webpager.BlingMgr.titleBling.stop();
},0);
});
this.addModelEvent("groupChat_history_replace",function(_2fd){
This.renderHistory(_2fd);
});
this.addModelEvent("groupChat_name_changed",function(_2fe){
This.title.innerHTML=_2fe;
This.btnTitle.innerHTML=_2fe;
});
},closeList:function(){
this.onlineListBox.hide();
this.trigger.setAttribute("close","1");
this.popWin.style.width="302px";
this.trigger_a.delClass("right");
this.trigger_a.addClass("left");
XN.webpager.RoomKeeper.saveCollapse(this.model.getId());
},openList:function(){
this.onlineListBox.show();
this.trigger.setAttribute("close","");
this.trigger_a.delClass("left");
this.trigger_a.addClass("right");
this.popWin.style.width="425px";
XN.webpager.RoomKeeper.unsaveCollapse(this.model.getId());
},disable:function(msg){
this.input.disabled=true;
This.addAGsp({userId:"",tinyurl:"",timestamp:new Date().getTime(),userName:"\u7cfb\u7edf\u6d88\u606f",content:"\u62b1\u6b49\uff0c\u4f60\u6ca1\u6709\u6743\u9650\u5728\u672c\u7fa4\u7ee7\u7eed\u53d1\u8a00",type:"system"});
},buildAttendee:function(_300){
XN.webpager.tools.injectHtml(this.onlineList,this.makeAtendeeList(_300));
},makeAtendeeList:function(_301){
var len=_301.length;
if(!len){
return "";
}
var html=[];
for(var i=0;i<len;i++){
html.push(this.makeAAtendee(_301[i]));
}
return html.join("");
},appendAttendee:function(att){
var html=this.makeAAtendee(att);
XN.webpager.tools.appendHTML5(this.onlineList,html);
},delAttendee:function(att){
$(this.model.getId()+"-"+att.id).remove();
},renderHistory:function(_308){
XN.webpager.tools.injectHtml(this.gspList,this.makeHistory(_308));
},makeHistory:function(_309){
var This=this;
var html="";
var temp={};
XN.array.each(_309,function(i,gsp){
html+=This.makeAGsp(gsp);
});
return html;
},makeAGsp:function(gsp){
if(gsp.tiny.indexOf("http://")==-1){
if(gsp.tiny.indexOf("_tiny.gif")!=-1){
gsp.tiny="http://head.xiaonei.com/photos/"+gsp.tiny;
}else{
gsp.tiny="http://hdn.xnimg.cn/photos/"+gsp.tiny;
}
}
var _310="<img width=\"30\" height=\"30\" onload=\"clipImage(this)\" src=\""+gsp.tiny+"\"/>";
var _311="<a href=\"http://www."+XN.env.domain+"/profile.do?id="+gsp.id+"\">"+gsp.name;
if(gsp.type=="system"){
_311="<span>"+gsp.name+"</span>";
_310="";
}
return ["<section>","<figure class=\"avatar\">"+_310+"</figure>","<header>","<span class=\"user\">",_311,"</a></span>","<span class=\"time\">",gsp.mtime||XN.webpager.tools.getTime(new Date(parseInt(gsp.timestamp))),"</span>","</header>","<section>","<p>",gsp.message,"</p>","</section>","<footer>","</footer>","</section>"].join("");
},addAGsp:function(gsp){
XN.webpager.tools.appendHTML5(this.gspList,this.makeAGsp(gsp));
this.gspListScrollBtm(true);
},gspListScrollBtm:function(_313){
if(_313===false){
this.gspList.scrollTop=this.gspList.scrollHeight;
return;
}
var This=this;
var _315=this.gspList.scrollHeight;
var _316=this.gspList.scrollTop;
var _317=_315-this.lastScrollHeight;
var _318=_315-_316-344;
var q=0.93;
var n=20;
var Sn=_317+_318;
if(_315<=this.initScrl_h){
return;
}
if(Sn<345){
q=0.618;
}
var a1=Sn*(1-q)/(1-Math.pow(q,n));
var _313=function(ele,_31e,dual){
for(var i=1;i<=20;i++){
(function(_321){
_12(function(){
var t=Math.ceil(a1*Math.pow(q,_321-1));
ele.scrollTop+=t;
},i*(dual/n));
})(i);
}
};
_313(This.gspList,Sn,800);
this.lastScrollHeight=this.gspList.scrollHeight;
this.lastScrollTop=this.gspList.lastScrollTop;
},showHlight:function(){
this.element.addClass("toread");
if(XN.browser.IE6){
}
if(webpager.isLocalConnect()){
XN.webpager.BlingMgr.titleBling.start();
}
},delHlight:function(){
try{
this.element.delClass("toread");
if(XN.browser.IE6){
}
_12(function(){
XN.webpager.BlingMgr.titleBling.stop();
},0);
}
catch(e){
if(XN.webpager.debug){
alert(e);
}
XN.webpager.tools.logExpt("c19",e);
}
},makeAAtendee:function(obj){
var tiny=obj.tiny;
if(obj.tiny.indexOf("http://")==-1){
if(tiny.indexOf("_tiny.gif")!=-1){
tiny="http://head.xiaonei.com/photos/"+tiny;
}else{
tiny="http://hdn.xnimg.cn/photos/"+tiny;
}
}
return ["<figure id=\"",this.model.getId()+"-"+obj.id,"\" talktrigger=\"",obj.id,"\">","<img src=\""+tiny+"\" width=\"24\" height=\"24\" talktrigger=\"",obj.id,"\"/>","<figcaption talktrigger=\"",obj.id,"\" >"+XN.webpager.tools.noMoreThan(obj.name,4)+"</figcaption>","</figure>"].join("");
}});
(function(xw){
xw.GroupChatRoom=function(_326){
xw.ChatRoom.call(this,_326);
this.attendee=[];
this.readyFns=[];
this.history=[];
if(_326.onReady){
this.readyFns.push(_326.onReady);
}
this.init();
};
$extend(xw.GroupChatRoom.prototype,xw.ChatRoom.prototype);
$extend(xw.GroupChatRoom.prototype,{isReady:false,notify:true,init:function(){
var This=this;
this.asyncMgr=new XN.webpager.AsyncMgr();
this.asyncMgr.register("getRoomInfo");
this.asyncMgr.register("getRoomSetting");
this.asyncMgr.addEvent("asyncMgr_all_done",function(){
This.isReady=true;
This.doReady();
});
xw.AsyncMgr.qDo(function(){
This.getRoomInfo();
});
xw.AsyncMgr.qDo(function(){
This.getRoomSetting();
});
_12(function(){
This.loadHistory();
},500);
},getId:function(){
return this.roomId;
},serialize:function(){
return this.roomId+"_"+this.roomName+".3";
},attendeeRplc:function(ary){
this.attendee=ary;
this.fireEvent("grouproom_attendee_replace",this.attendee);
},broadcast:function(_329){
try{
var p={fromuin:XN.user.id,fronmname:XN.user.name,touin:this.getId(),msg_content:_329};
webpager.sendMessage(p,"groupchat");
var m={from:this.getId()+"@group.talk.xiaonei.com/"+XN.user.name+"(0)-"+XN.user.id,to:XN.user.id+"@talk.xiaonei.com/WTalkProxy6_0",content:"{type:\"groupchat\",info:{roomid:\""+this.getId()+"\",roomname:\""+this.roomName+"\",userid:\""+XN.user.id+"\"}, chat:\""+_329+"\"}"};
webpager.showGroupChat(m);
}
catch(e){
if(XN.webpager.debug){
alert(e);
}
XN.webpager.tools.logExpt("c20",e);
}
},getAttendee:function(id){
var len=this.attendee.length;
for(var i=0;i<len;i++){
if(this.attendee[i].id==id){
return this.attendee[i];
}
}
return null;
},delAttendee:function(id){
var len=this.attendee.length;
for(var i=0;i<len;i++){
if(this.attendee[i].id==id){
this.fireEvent("groupChat_attendee_del",this.attendee.splice(i,1)[0]);
break;
}
}
},pushAttendee:function(at){
var len=this.attendee.length;
for(var i=0;i<len;i++){
if(this.attendee[i].id==at.id){
this.fireEvent("groupChat_attendee_stateChange",at);
return;
}
}
this.attendee.push(at);
this.fireEvent("groupChat_attendee_push",at);
},pushSystemMsg:function(obj){
this.pushGsp(obj);
},hisRplc:function(_336,_337){
this.gsps=_336;
this.fireEvent("groupChat_history_replace",this.gsps,_337);
},ready:function(fn){
if(!this.isReady){
this.readyFns.push(fn);
}else{
fn.call(this);
}
},doReady:function(){
for(var i=0;i<this.readyFns.length;i++){
this.readyFns[i].call(this,i);
}
},loadHistory:function(){
var This=this;
var p={gid:this.getId()};
new XN.net.xmlhttp({url:"http://notify."+XN.env.domain+"/wpi/getgrouphistory.do?r="+Math.random(),method:"get",data:XN.array.toQueryString(p),onSuccess:function(r){
var obj=XN.json.parse(r.responseText);
if(obj&&obj.history.length){
obj.history=This.gsps.concat(obj.history);
obj.history.sort(function(a,b){
if(a.timestamp>b.timestamp){
return 1;
}
if(a.timestamp<=b.timestamp){
return -1;
}
});
var len=obj.history.length;
for(var i=0;i<len;i++){
obj.history[i].timestamp*=1000;
}
This.ready(function(){
This.hisRplc(obj.history,This.gspFire);
});
}
}});
},getRoomSetting:function(){
var This=this;
new XN.net.xmlhttp({url:"http://qun."+XN.env.domain+"/qun/"+this.getId()+"/chatFlag?r="+Math.random(),method:"get",onSuccess:function(r){
var obj=XN.json.parse(r.responseText);
if(obj&&obj.code==0){
This.notify=obj.chatFlag;
This.asyncMgr.thisDone("getRoomSetting");
}
}});
},disable:function(msg){
this.disable=true;
this.fireEvent("groupChat_disble",msg);
},getRoomInfo:function(fn){
var This=this;
var p={gid:this.getId()};
var req=new XN.net.xmlhttp({url:"http://notify."+XN.env.domain+"/wpi/getroominfo.do?r="+Math.random(),method:"get",data:XN.array.toQueryString(p),onSuccess:function(r){
var obj=XN.json.parse(r.responseText);
if(obj){
This.attendeeRplc(obj.attendee);
}
if(fn){
fn.call(This);
}
This.asyncMgr.thisDone("getRoomInfo");
},onError:function(e){
}});
}});
})(XN.webpager);
XN.webpager.UgcWindow=function(_34d){
_34d.canLeave=true;
$extend(this,_34d);
this.init(_34d);
this.tag="conv";
$(this.element).addClass("popupwindow");
};
extendClass(XN.webpager.UgcWindow,XN.webpager.abstractWindow);
$extend(XN.webpager.UgcWindow.prototype,{prefix:"16-",ugcMap:{1:{str:"\u5206\u4eab",icon:XN.webpager.url.WPI_SHARE_COMMON,icon_hlight_ie6:XN.webpager.url.WPI_SHARE_COMMON,tag:"share"},5:{str:"\u72b6\u6001",icon:XN.webpager.url.WPI_STATUS_COMMON,icon_hlight_ie6:XN.webpager.url.WPI_STATUS_HLIGHT,tag:"status"},7:{str:"\u7167\u7247",icon:XN.webpager.url.WPI_PHOTO_COMMON,icon_hlight_ie6:XN.webpager.url.WPI_PHOTO_HLIGHT,tag:"photo"}},getUgcType:function(_34e){
var type;
_34e=_34e+"";
switch(_34e){
case "5030":
type=1;
break;
default:
type=parseInt((_34e+"").charAt(0));
break;
}
return this.ugcMap[type];
},xinit:function(){
var This=this;
if(this.width){
this.button.style.width=parseInt(this.width)+"px";
}
this.inputHelper=XN.form.help(this.input);
var ugc=this.model.ugc;
var type=parseInt((ugc.feed_stype+"").charAt(0));
object.use("xn.mention",function(_353,xn){
xn.mention.Mention.init([{obj:$(This.input),ugcId:ugc.feed_source,ugcType:This.getUgcType(ugc.feed_stype).tag,ownerId:ugc.feed_actor,popTop:true,scrollable:true}]);
if(!XN.cookie.get("at")){
XN.cookie.set("at","1",1,"/","renren.com");
}
});
},xAddEvent:function(){
var This=this;
var wp=XN.webpager;
function broadcast(){
var _357=This.input.value;
var _358=This.input;
if(XN.string.trim(_357)!=""){
_357=_357.replace(/\(悄悄话\)/,"");
This.model.broadcast(_357);
}
_12(function(){
_358.value="";
_358.focus();
},0);
}
this.btn.addEvent("click",function(e){
e=e||window.event;
XN.event.stop(e);
broadcast();
});
this.input.addEvent("keydown",function(e){
e=e||window.event;
if(e.keyCode==13){
if(This.input.mention&&This.input.mention.selectorShow&&!This.input.mention.noMatch){
return;
}
broadcast();
}
if(e.ctrlKey&&e.keyCode==69){
if(This.model.isActive()){
This.model.destroy();
}
}
});
this.input.addEvent("focus",function(e){
XN.webpager.lookAtThisWin=true;
});
this.input.addEvent("blur",function(e){
XN.webpager.lookAtThisWin=false;
});
this.element.addEvent("click",function(e){
e=e||window.event;
var obj=e.srcElement||e.target;
if(obj&&obj.getAttribute&&obj.getAttribute("wtype")){
var name=obj.getAttribute("wname");
var _360=(obj.getAttribute("whisper")=="true");
var id=obj.getAttribute("wid");
This.model.replyName=name;
This.model.replyTo=id;
if(_360){
This.input.value="\u56de\u590d"+name+"(\u6084\u6084\u8bdd)\uff1a";
This.model.isWhisper=true;
}else{
This.input.value="\u56de\u590d"+name+"\uff1a";
This.model.isWhisper=false;
}
This.inputHelper.focus();
}
});
this.addEvent("ua_open_window",function(){
XN.webpager.tools.log("http://track.yx.renren.com/statmop/dfa1?dfaid="+(This.prefix=="16-"?"8065":"8064"));
});
this.addEvent("view_window_active",function(){
XN.webpager.notifyBox.delAll(This.model.source,This.prefix);
This.delHlight();
This.gspListScrollBtm();
This.model.startConv(true,false);
});
this.addEvent("view_window_disactive",function(){
This.delHlight();
This.model.disactive();
});
this.addEvent("view_window_close",function(){
This.model.destroy();
});
this.addEvent("view_window_maximize",function(){
var ugc=This.model.ugc;
window.open(This.getMoreLink(),"_blank");
});
This.leaveBtn.addEvent("click",function(){
This.model.leave();
This.model.destroy();
});
if(XN.browser.WebKit){
function closeNotice(obj){
$(obj.parentNode).hide();
XN.webpager.persistMgr.setWpiCookie("ntc","1",365);
}
this.startNotifyBtn&&this.startNotifyBtn.addEvent("click",function(){
if(webkitNotifications){
webkitNotifications.requestPermission();
closeNotice(This.startNotifyBtn);
}
});
this.noticeClose&&this.noticeClose.addEvent("click",function(){
closeNotice(This.noticeClose);
});
}
this.addModelEvent("room_gossip_push",function(gsp){
if(!This.active&&!gsp.isHost){
This.showHlight();
}else{
XN.webpager.notifyBox.delAll(This.model.source);
}
if(!gsp.isHost){
_18.log1("\u8fd9\u4e0d\u662f\u81ea\u5df1\u7684\u6d88\u606f,\u64ad\u653e\u58f0\u97f3!!!!!!");
XN.webpager.mgr.playSound();
}
This.addAGsp(gsp);
});
this.addModelEvent("room_gsp_replace",function(gsps){
This.updateGsps(gsps);
});
this.addModelEvent("room_chat_started",function(_366){
_18.log1("[view]UgcWindow\u8981\u663e\u793a\u51fa\u6765");
This.delHlight();
if(!This.active){
_18.log1("\u8fd9\u4e2a\u7a97\u53e3\u5f53\u524d\u5904\u4e8e\u975e\u6fc0\u6d3b\u72b6\u6001, \u73b0\u5728\u628a\u5b83\u6fc0\u6d3b");
This.show(_366);
}else{
_18.log1("\u8fd9\u4e2a\u7a97\u53e3\u5f53\u524d\u5904\u4e8e\u6fc0\u6d3b\u72b6\u6001, \u4ec0\u4e48\u4e5f\u4e0d\u7528\u505a");
}
This.gspListScrollBtm();
});
this.addModelEvent("room_chat_disactive",function(_367){
This.hide(false);
});
this.addModelEvent("room_destroy",function(msg){
This.destroy();
_12(function(){
XN.webpager.BlingMgr.titleBling.stop();
},0);
});
this.addModelEvent("room_broadcast_error",function(code,_36a,ret){
var gsp={from_id:wp.User.id,from_name:"",from_pic:"",mtime:"\u7cfb\u7edf\u6d88\u606f:"+wp.tools.getTime(),ugc_content:wp.msg.SPAM[code]+". \u6d88\u606f\""+_36a+"\"\u53d1\u9001\u5931\u8d25"};
This.model.pushGsp(gsp);
});
},pushMsg:function(obj){
},getMoreLink:function(){
var ugc=this.model.ugc;
return "http://status."+XN.env.domain+"/getdoing.do?id="+ugc.feed_actor+"&doingId="+ugc.feed_source+"&ref=newsfeed&sfet=502&fin=0";
},autoWidth:function(){
var _36f=this.ugcTopicDiv?this.ugcTopicDiv.offsetWidth:0;
if(_36f){
_36f+=10;
}
this.popWin.style.width=(this.gspListDiv.offsetWidth+_36f)+"px";
this.header.style.width=(this.gspListDiv.offsetWidth+_36f)+"px";
this.popWin.style.zoom=1.1;
this.popWin.style.zoom=1;
},show:function(_370){
var This=this;
_18.log1("show\u51fd\u6570: focus\u4e3a"+_370);
this.superPro.show.apply(this,arguments);
this.active=true;
_18.log1("show, focus is "+_370);
if(_370!==false){
_18.log1("\u8981focus");
this.element.getElementsByTagName("textarea")[0].focus();
}else{
this.element.getElementsByTagName("textarea")[0].blur();
}
this.autoWidth();
this.myGroup.fireEvent("view_a_window_actived");
},getIconUrl:function(_372,_373){
var type=(parseInt(this.skinType)+"").charAt(0);
var u=this.ugcMap[type];
if(_372=="hlight"&&_373){
return u["icon_hlight_ie6"];
}else{
return u["icon"];
}
},showHlight:function(){
this.element.addClass("toread");
if(XN.browser.IE6){
(this.element.getElementsByTagName("img")[0]).src=this.getIconUrl("hlight",true);
}
if(webpager.isLocalConnect()){
XN.webpager.BlingMgr.titleBling.start();
}
},delHlight:function(){
try{
this.element.delClass("toread");
if(XN.browser.IE6){
(this.element.getElementsByTagName("img")[0]).src=this.getIconUrl("common",true);
}
_12(function(){
XN.webpager.BlingMgr.titleBling.stop();
},0);
}
catch(e){
XN.webpager.tools.logExpt("c16",e);
}
},getDefaultOptions:function(){
var _376=XN.webpager.friendsWindow.superClass.getDefaultOptions.call(this);
return $extend(_376,{canClose:true,canMax:true});
},getButton:function(){
var _377=this.strButton||"";
return _377;
},getContent:function(){
this.strContent=this.strContent?this.strContent+this.makeContent():""+this.makeContent();
return this.strContent;
},makeContent:function(){
return this.makeGspList();
},buildGsps:function(list){
var l=list||this.model.gsps;
var This=this;
var gsps=[];
XN.array.each(l,function(i,gsp){
gsps.push(This.makeAGsp(gsp));
});
return gsps.join("");
},upUgc:function(ugc,_37f){
var e=ugc.entity;
if(e.host_pic.indexOf("http:")!=0){
if(/men_tiny\.gif$/.test(e.host_pic)){
e.host_pic="http://head.xiaonei.com/photos/"+e.host_pic;
}else{
e.host_pic="http://hdn.xnimg.cn/photos/"+e.host_pic;
}
}
var u=this.getUgcType(ugc.feed_stype);
e.title=XN.webpager.tools.noMoreThan(e.host_name,3)+"\u7684"+u.str;
var _382=document.createElement("div");
_382.innerHTML="<img class=\"icon\" src=\""+u.icon+"\" /> "+e.title;
var _383=XN.webpager.tools;
if(XN.browser.IE){
this.header.appendChild(_383.getDom(this.getHeader(e)));
}else{
this.header.appendHTML(this.getHeader(e));
}
this.subHead=this.element.getElementsByTagName("h5")[0];
this.subHead.innerHTML="";
try{
var _384=_383.getHTMLThumb(e.content,59,true);
this.subHead.innerHTML=_384.HTMLStr;
this.subHead.setAttribute("title",_384.rawStr);
}
catch(err){
var t=e.content;
if(XN.browser.IE){
t=t.replace(/&apos;/g,"\"");
}
t=_383.unescapeHTML(t);
this.subHead.innerHTML=t;
}
this.winBtn.appendChild(_382);
if(_37f!==false){
this.showHlight();
}
},getHeader:function(en){
var t=en||this.topic;
if(!t){
return;
}
return ["<figure>","<a href=\"http://www."+XN.env.domain+"/profile.do?id="+t.host_id+"\" target=\"_blank\"><img height=\"50\" width=\"50\" src=\""+(t.host_pic||XN.webpager.url.OFFLINE_IMG)+"\"/></a>","</figure>","<h4>",t.title,"</h4>","<h5 class=\"subheading\"> ",t.content,"</h5>"].join("");
},makeGspList:function(){
return ["<div class=\"hbox dialog\">","<div class=\"dialogs hbox\">","<article class=\"dialogs\">","</article>","</div>","<div class=\"editor hbox\">","<form class=\"editor\" action=\"/n/core/src/layouts/../modules/webpager/\"method=\"post\">","<div class=\"toolbar\">","<ul class=\"main\">","</ul>","</div>","<textarea></textarea>","<input type=\"image\" src=\"http://s.xnimg.cn/n/core/res/webpager/send-button.png\"/>","</form>","</div>","</div>"].join("");
},makeAGsp:function(c){
var _389="";
var user=XN.user;
var _38b=(c.is_whisper=="1");
if(c.from_pic){
_389="<img width=\"30\" height=\"30\" onload=\"clipImage(this)\" src=\""+c.from_pic+"\"/>";
}
var _38c="@"+decodeURIComponent(user.name)+"("+user.id+") ";
try{
var a=["<section>","<figure class=\"avatar\">"+_389+"</figure>","<header>","<span class=\"user\"><a href=\"http://www.",XN.env.domain,"/profile.do?id=",c.from_id,"\">",c.from_name,"</a></span>","<span class=\"time\">",c.mtime||XN.webpager.tools.getTime(new Date(parseInt(c.timestamp))),_38b?" <img title=\"\u5618!\u8fd9\u662f\u6084\u6084\u8bdd~\" src=\"http://a.xnimg.cn/img/lock_red_new.png\"/>":"","</span>","</header>","<section>","<p>",XN.webpager.tools.atFilter(c.ugc_content),"</p>","</section>","<footer>",XN.webpager.User.id!=c.from_id?"<a wtype=\"reply\" whisper=\""+_38b+"\"  wname=\""+c.from_name+"\" wid=\""+c.from_id+"\" wid=\"\" onclick=\"return false;\" href=\"javascript:void(0)\">\u56de\u590d</a>":"","</footer>","</section>"].join("");
return a;
}
catch(e){
if(XN.webpager.debug){
_18.log1(e);
}
XN.webpager.tools.logExpt("c17",e);
}
},_unescape:function(html){
return html.replace(/'/g,"\"");
},addAGsp:function(gsp){
_18.log1("[addAGsp]");
var _390=XN.webpager.tools;
if(XN.browser.IE){
try{
var t=this.makeAGsp(gsp);
this.gspList.appendChild(_390.getDom(t));
window.ttest4=this.gspList.innerHTML;
}
catch(e){
if(XN.webpager.debug){
alert(e);
}
XN.webpager.tools.logExpt("c18",e);
}
}else{
this.gspList.appendChild($make(this.makeAGsp(gsp)));
}
this.gspListScrollBtm(100);
},hasThisGsp:function(gsp){
var gsps=this.model.gsps;
var len=gsps.length;
if(!len){
return false;
}
for(var i=0;i<len;i++){
if(gsps[i].ugc_content==gsp.ugc_content){
return true;
}
}
return false;
},updateGsps:function(list){
var This=this;
if(XN.browser.IE){
var t=this.buildGsps(list);
this.gspList.innerHTML="";
this.gspList.appendChild(XN.webpager.tools.getDom(t));
}else{
_12(function(){
This.gspList.innerHTML=This.buildGsps(list);
},100);
}
this.gspListScrollBtm();
},gspListScrollBtm:function(t){
var This=this;
_12(function(){
This.gspList.scrollTop=This.gspList.scrollHeight;
},t||500);
},getUIRef:function(){
this.gspList=Sizzle("article.dialogs",this.element)[0];
this.popWin=this.element.getElementsByTagName("article")[0];
this.btn=$(this.element.getElementsByTagName("input")[0]);
this.input=$(this.element.getElementsByTagName("textarea")[0]);
this.header=$(this.element.getElementsByTagName("header")[0]);
this.winBtn=$(this.element.getElementsByTagName("div")[0]);
this.icon=$(this.winBtn.getElementsByTagName("img")[0]);
this.editor=$(Sizzle("div.editor",this.element)[0]);
this.startNotifyBtn=$(Sizzle("button.start",this.element)[0]);
this.leaveBtn=$(this.header.getElementsByTagName("li")[0]);
var t=Sizzle("div.topic",this.popWin);
this.ugcTopicDiv=t.length?t[0]:null;
this.gspListDiv=Sizzle("div.dialog",this.popWin)[0];
this.getNotifyTip();
},getNotifyTip:function(){
var self=this;
var pMgr=XN.webpager.persistMgr;
if(!window.webkitNotifications||window.webpager.notificationPermission()!=1){
return;
}
var ck=pMgr.getWpiCookieBy("never-tip-chrome-notification");
if(ck){
return;
}
var HTML=["<article title=\"\u5f00\u542f\u540e,\u6536\u5230\u5b9e\u65f6\u6d88\u606f\u4f1a\u5728\u684c\u9762\u51fa\u73b0\u63d0\u793a.(Chrome\u6d4f\u89c8\u5668\u4e13\u6709)\" style=\"position: absolute; right:75px; background-color:#FFFCC9; color:#777; padding:0 5px; z-index: 5; bottom: -9px; height: 16px; width: 200px; cursor:default;\">","\u5f00\u542f\u6d4f\u89c8\u5668\u6d88\u606f\u63d0\u9192\u529f\u80fd: ","<a href=\"#nogo\">\u786e\u8ba4</a>/<a href=\"#\">\u53d6\u6d88</a>","</article>"];
var obj=document.createElement("div");
obj.innerHTML=HTML.join("");
function hideTip(){
XN.webpager.UgcWindow.chromeTips.forEach(function(t){
t.style.display="none";
});
}
var btns=obj.getElementsByTagName("a");
btns[0].onclick=function(e){
e.preventDefault();
window.webpager.notificationRequest(function(p){
if(p==0){
window.webpager.notificationShow({head:"http://a.xnimg.cn/n/core/res/webpager/notifications.gif",name:"\u64cd\u4f5c\u6210\u529f",content:"\u60a8\u5df2\u7ecf\u6210\u529f\u5f00\u542f\u684c\u9762\u63d0\u9192\u529f\u80fd,Chrome\u6d4f\u89c8\u5668\u4e13\u6709\u54e6."});
hideTip();
}else{
if(p==2){
XN.DO.alert("\u60a8\u9009\u62e9\u4e86\u62d2\u7edd. <br /> \u5982\u679c\u4eca\u540e\u60f3\u91cd\u65b0\u5f00\u542f,\u53ef\u4ee5\u76f4\u63a5\u5728Chrome\u7684\"\u9009\u9879\"\u4e2d\u8fdb\u884c\u8bbe\u7f6e.");
hideTip();
}
}
});
};
btns[1].onclick=function(){
pMgr.setWpiCookie("never-tip-chrome-notification",1,300);
obj.getElementsByTagName("article")[0].innerHTML="\u6253\u6270\u4e86 ^_^";
_12(hideTip,2000);
};
this.editor.appendChild(obj);
if(!XN.webpager.UgcWindow.chromeTips){
XN.webpager.UgcWindow.chromeTips=[];
}
XN.webpager.UgcWindow.chromeTips.push(obj);
},UIPrepare:function(){
var This=this;
var n=XN.webpager.notice.winAD;
if(n&&n.isAvailable()){
if(this.gspList){
n.ready(function(){
var m=n.makeElement(0);
$(This.gspList.parentNode).appendChild(m,This.gspList);
n.bindEvent(m);
});
}
}
},showElement:function(){
$(this.element).show();
},hideElement:function(){
$(this.element).hide();
}});
XN.event.enableCustomEvent(XN.webpager.UgcWindow.prototype);
XN.webpager.PhotoWindow=function(_3a8){
_3a8.canLeave=true;
$extend(this,_3a8);
this.init(_3a8);
this.tag="conv";
$(this.element).addClass("popupwindow");
};
$extend(XN.webpager.PhotoWindow.prototype,XN.webpager.UgcWindow.prototype);
$extend(XN.webpager.PhotoWindow.prototype,{prefix:"18-",getUIRef:function(){
this.gspList=this.element.getElementsByTagName("article")[3];
this.popWin=this.element.getElementsByTagName("article")[0];
this.btn=$(this.element.getElementsByTagName("input")[0]);
this.input=$(this.element.getElementsByTagName("textarea")[0]);
this.header=$(this.element.getElementsByTagName("header")[0]);
this.editor=$(Sizzle("div.editor",this.element)[0]);
this.leaveBtn=$(this.header.getElementsByTagName("li")[0]);
this.winBtn=$(this.element.getElementsByTagName("div")[0]);
this.icon=$(this.winBtn.getElementsByTagName("img")[0]);
this.imgShow=Sizzle("article.topic img",this.element)[0];
this.startNotifyBtn=$(Sizzle("button.start",this.element)[0]);
var t=Sizzle("div.topic",this.popWin);
this.ugcTopicDiv=t.length?t[0]:null;
this.gspListDiv=Sizzle("div.dialog",this.popWin)[0];
this.popWin.style.width="512px";
if(!XN.browser.IE){
this.input.style.whiteSpace="pre-wrap";
}
if(this.startNotifyBtn){
$(this.startNotifyBtn.parentNode).hide();
}
this.getNotifyTip();
},UIPrepare:function(){
var This=this;
var n=XN.webpager.notice.winAD1;
if(n&&n.isAvailable()){
if(this.gspList){
n.ready(function(){
var m=n.makeElement(1);
$(This.gspList.parentNode).appendChild(m,This.gspList);
n.bindEvent(m);
});
}
}
},upUgc:function(ugc,_3ae){
XN.webpager.UgcWindow.prototype.upUgc.call(this,ugc,_3ae);
var This=this;
new XN.net.xmlhttp({url:this.getAjaxLink(),onSuccess:function(r){
var str=r.responseText;
if(!str){
return;
}
var obj=XN.json.parse(str);
This.imgShow.src=obj.photo.mainUrl;
}});
var _img=ugc.entity.photos[0];
this.imgShow.src=_img.big_image||_img.image;
try{
var _3b4=XN.webpager.tools.getHTMLThumb(_img.desc,59,true);
this.subHead.innerHTML="\u63cf&nbsp;&nbsp;\u8ff0: "+_3b4.HTMLStr;
this.subHead.setAttribute("title",_3b4.rawStr);
}
catch(err){
var t=_img.desc;
if(XN.browser.IE){
t=t.replace(/&apos;/g,"\"");
}
t=XN.webpager.tools.unescapeHTML(t);
this.subHead.innerHTML="\u63cf&nbsp;&nbsp;\u8ff0: "+t;
}
},getMoreLink:function(){
var ugc=this.model.ugc;
return "http://photo."+XN.env.domain+"/photo/"+ugc.feed_actor+"/photo-"+ugc.feed_source+"?curpage=0&t=";
},getAjaxLink:function(){
var ugc=this.model.ugc;
return "http://photo."+XN.env.domain+"/photo/"+ugc.feed_actor+"/photo-"+ugc.feed_source+"/ajax?untrack=true";
},makeGspList:function(){
var _3b8=(!XN.webpager.persistMgr.getWpiCookieBy("ntc"))&&XN.browser.WebKit;
var _3b9="<article class=\"system-notification\" "+(_3b8?"":"style=\"display:none;\"")+"><img class=\"icon\" src=\""+XN.webpager.url.WPI_BULB+"\" alt=\"\u901a\u77e5\" /> "+XN.webpager.msg.NOTICE2+"<button class=\"start\" style=\"margin:0 0 0 27px;\">\u5f00\u542f</button><a href=\"#\" class=\"x-closelink\">\u5173\u95ed</a></article>";
return ["<div class=\"box\">","<div class=\"vbox topic\">","<article class=\"topic\">","<section class=\"topic\">","<a target=\"_blank\" href=\""+this.getMoreLink()+"\"><img src=\"\" width=\"200\" /></a>","</section>","</article>","</div>","<div class=\"vbox dialog\">","<div class=\"dialogs hbox\">",_3b9,"<article class=\"dialogs\">","</article>","</div>","<div class=\"editor hbox\">","<form class=\"editor\" action=\"/n/core/src/layouts/../modules/webpager/\"method=\"post\">","<div class=\"toolbar\">","<ul class=\"main\">","</ul>","</div>","<textarea></textarea>","<input type=\"image\" src=\"http://s.xnimg.cn/n/core/res/webpager/send-button.png\"/>","</form>","</div>","</div>","</div>"].join("");
},getHeader:function(en){
var t=en||this.topic;
if(!t){
return;
}
return ["<figure>","<a href=\"http://www."+XN.env.domain+"/profile.do?id="+t.host_id+"\" target=\"_blank\"><img height=\"50\" width=\"50\" src=\""+(t.host_pic||XN.webpager.url.OFFLINE_IMG)+"\"/></a>","</figure>","<h4>",t.title,"</h4>","<h5 class=\"subheading\"> ","</h5>"].join("");
}});
XN.webpager.ShareWindow=function(_3bc){
_3bc.canLeave=true;
$extend(this,_3bc);
this.init(_3bc);
this.tag="conv";
$(this.element).addClass("popupwindow");
};
$extend(XN.webpager.ShareWindow.prototype,XN.webpager.PhotoWindow.prototype);
$extend(XN.webpager.ShareWindow.prototype,{prefix:"58-",getUIRef:function(){
try{
this.gspList=this.element.getElementsByTagName("article")[2];
this.popWin=this.element.getElementsByTagName("article")[0];
this.btn=$(this.element.getElementsByTagName("input")[0]);
this.input=$(this.element.getElementsByTagName("textarea")[0]);
this.header=$(this.element.getElementsByTagName("header")[0]);
this.leaveBtn=$(this.header.getElementsByTagName("li")[0]);
this.winBtn=$(this.element.getElementsByTagName("div")[0]);
this.icon=$(this.winBtn.getElementsByTagName("img")[0]);
this.imgShow=Sizzle("article.topic img",this.element)[0];
this.thumb=$(Sizzle("div.thumbnails",this.element)[0]);
this.playBtn=$(Sizzle("div.thumbnails a",this.element)[0]);
this.player=$(Sizzle("div.player",this.element)[0]);
this.closeVedio=$(Sizzle("div.operation a",this.element)[0]);
this.op=$(Sizzle("div.operation",this.element)[0]);
var t=Sizzle("div.topic",this.popWin);
this.ugcTopicDiv=t.length?t[0]:null;
this.gspListDiv=Sizzle("div.dialog",this.popWin)[0];
this.section=this.element.getElementsByTagName("section")[0];
this.ugcTopicDiv.style.width="150px";
this.popWin.style.width="450px";
if(!XN.browser.IE){
this.input.style.whiteSpace="pre-wrap";
}
this.editor=$(Sizzle("div.editor",this.element)[0]);
this.getNotifyTip();
}
catch(e){
_18.log1(e);
}
},xAddEvent:function(){
XN.webpager.UgcWindow.prototype.xAddEvent.call(this);
var This=this;
this.playBtn.addEvent("click",function(e){
var e=e||window.event;
This.showPlayer();
XN.event.stop(e);
return false;
});
this.closeVedio.addEvent("click",function(){
This.hidePlayer();
});
this.addEvent("view_window_inited",function(){
XN.loadFile("http://s.xnimg.cn/a22776/n/core/modules/webpager/cssimg/webpager-specified.css",function(){
});
});
this.addEvent("view_window_disactive",function(){
This.hidePlayer();
});
},showPlayer:function(){
window.tt=this;
this.thumb.hide();
this.op.show();
this.player.innerHTML="<embed style=\"width:100%;height:100%\" allowscriptaccess=\"sameDomain\" allownetworking=\"all\" wmode=\"transparent\" allowfullscreen=\"true\" type=\"application/x-shockwave-flash\" src=\""+this.model.ugc.entity.url+"\">";
this.popWin.style.width="660px";
this.header.style.width="660px";
this.ugcTopicDiv.style.width="360px";
this.section.style.width="660px";
this.player.style.height="297px";
this.player.show();
},hidePlayer:function(){
this.popWin.style.width="450px";
this.header.style.width="450px";
this.section.style.width="450px";
this.thumb.show();
this.player.hide();
this.player.innerHTML="";
this.ugcTopicDiv.style.width="150px";
this.op.hide();
},makeContent:function(){
return this.makeGspList();
},upUgc:function(ugc,_3c1){
XN.webpager.UgcWindow.prototype.upUgc.call(this,ugc,_3c1);
var _3c2=ugc.entity;
this.thumb.style.backgroundImage="url(\""+_3c2.image+"\")";
this.subHead.innerHTML=_3c2.headtitle;
},getMoreLink:function(){
var ugc=this.model.ugc;
var _3c4=ugc.entity;
return "http://share.renren.com/share/"+ugc.feed_actor+"/"+_3c4.share_id;
},getAjaxLink:function(){
var ugc=this.model.ugc;
return "http://photo."+XN.env.domain+"/photo/"+ugc.feed_actor+"/photo-"+ugc.feed_source+"/ajax?untrack=true";
},makeGspList:function(){
return ["<div class=\"box\">","<div class=\"vbox topic\">","<article class=\"topic\">","<section class=\"topic clearfix\">","<div class=\"thumbnails video\" style=\"width:128px;height:96px;background-repeat:no-repeat;\" class=\"video\"><a target=\"_blank\" class=\"button\" href=\"#\">\u64ad\u653e</a></div>","<div class=\"player\"></div>","<div class=\"operation\" style=\"display:none;\"><a href=\"#\" onclick=\"return false;\"><img src=\"http://a.xnimg.cn/n/core/modules/webpager/cssimg/collapsetrigger.png\" /> \u6536\u8d77\u89c6\u9891</a></div>","</section>","</article>","</div>","<div class=\"vbox dialog\">","<div class=\"dialogs hbox\">","<article class=\"dialogs\">","</article>","</div>","<div class=\"editor hbox\">","<form class=\"editor\" action=\"/n/core/src/layouts/../modules/webpager/\"method=\"post\">","<div class=\"toolbar\">","<ul class=\"main\">","</ul>","</div>","<textarea></textarea>","<input type=\"image\" src=\"http://s.xnimg.cn/n/core/res/webpager/send-button.png\"/>","</form>","</div>","</div>","</div>"].join("");
},getHeader:function(en){
var t=en||this.topic;
if(!t){
return;
}
return ["<figure>","<a href=\"http://www."+XN.env.domain+"/profile.do?id="+t.host_id+"\" target=\"_blank\"><img height=\"50\" width=\"50\" src=\""+(t.host_pic||XN.webpager.url.OFFLINE_IMG)+"\"/></a>","</figure>","<h4>",t.title,"</h4>","<h5 class=\"subheading\"> ","</h5>"].join("");
}});
XN.webpager.PhotoShareWindow=function(_3c8){
_3c8.canLeave=true;
$extend(this,_3c8);
this.init(_3c8);
this.tag="conv";
$(this.element).addClass("popupwindow");
};
$extend(XN.webpager.PhotoShareWindow.prototype,XN.webpager.PhotoWindow.prototype);
$extend(XN.webpager.PhotoShareWindow.prototype,{prefix:"233-",getMoreLink:function(){
var ugc=this.model.ugc;
return "http://share.renren.com/share/"+ugc.feed_actor+"/"+ugc.feed_source+"?ref=webpager_realTime";
},getAjaxLink:function(){
var url=this.model.ugc.entity.photos[0].url;
if(/\?$/.test(url)){
url=url.substr(0,url.length-1);
}
return url+"/ajax?untrack=true";
}});
(function(xw){
xw.UgcChatRoom=function(_3cc,ugc){
xw.ChatRoom.call(this,_3cc);
this.ugc=ugc;
};
$extend(xw.UgcChatRoom.prototype,xw.ChatRoom.prototype);
$extend(xw.UgcChatRoom.prototype,{superPro:xw.ChatRoom.prototype,stypeMap:{502:3,701:1,708:1,709:1,110:4,103:4,5030:4},getId:function(){
if(!this.id){
this.id=this.ugc.feed_actor+"_"+this.ugc.feed_source+"_"+this.ugc.feed_stype;
}
return this.id;
},serialize:function(){
return this.getId()+".2";
},loadHistory:function(ugc){
this.asyncloadHistory(ugc);
},asyncloadHistory:function(ugc){
var This=this;
p={doingId:ugc.feed_source,owner:ugc.feed_actor,source:ugc.feed_source,t:this.stypeMap[ugc.feed_stype]};
XN.webpager.tools.log2("22&source="+ugc.feed_source+"&stype="+ugc.feed_stype+"&actor="+ugc.feed_actor+"&empty=5");
new XN.net.xmlhttp({url:"http://status."+XN.env.domain+"/feedcommentretrieve.do",data:XN.array.toQueryString(p),onSuccess:function(res){
try{
var list=XN.json.parse(res.responseText);
list=list.replyList;
var ret=[];
if(list){
This.dataAdapt(ret,list,false,ugc);
}else{
XN.webpager.tools.log2("23&source="+ugc.feed_source+"&stype="+ugc.feed_stype+"&actor="+ugc.feed_actor+"&empty=2");
}
This.replaceGsp(ret);
}
catch(e){
XN.webpager.tools.log2("24&source="+ugc.feed_source+"&stype="+ugc.feed_stype+"&actor="+ugc.feed_actor+"&empty=3");
}
},onError:function(){
XN.webpager.tools.log2("25&source="+ugc.feed_source+"&stype="+ugc.feed_stype+"&actor="+ugc.feed_actor+"&empty=4");
}});
this.fireEvent("room_gsp_loaded",this.gsps);
},dataAdapt:function(ret,list,sb,ugc){
var len=list.length;
var r;
if(!len){
XN.webpager.tools.log2("26&source="+ugc.feed_source+"&stype="+ugc.feed_stype+"&actor="+ugc.feed_actor+"&empty=6");
}else{
XN.webpager.tools.log2("27&source="+ugc.feed_source+"&stype="+ugc.feed_stype+"&actor="+ugc.feed_actor+"&empty=6");
}
if(sb){
window.list=list;
for(var j=0;j<len;j++){
r=list[j];
ret.unshift({from_name:r.ubname,from_pic:r.replyer_tinyurl,from_id:r.ubid,mtime:r.replyTime.substring(5),ugc_content:r.replyContent});
}
}else{
for(var i=len-1;i>=0;i--){
r=list[i];
ret.unshift({from_name:r.ubname,from_pic:r.replyer_tinyurl,from_id:r.ubid,mtime:r.replyTime.substring(5),ugc_content:r.replyContent});
if(len-i==10){
break;
}
}
}
},asyncloadTopic:function(){
var This=this;
var ugc=this.ugc;
var tls=XN.webpager.tools;
tls.log2("31&source="+ugc.feed_source+"&stype="+ugc.feed_stype+"&actor="+ugc.feed_actor+"&empty=-1");
new XN.net.xmlhttp({url:"http://notify.renren.com/get2.feed?actor="+ugc.feed_actor+"&source="+ugc.feed_source+"&stype="+ugc.feed_stype,useCache:true,onSuccess:function(r){
var obj=XN.json.parse(r.responseText);
if(!r.responseText){
obj=null;
}else{
if(XN.json.build(obj)=="{}"){
obj=null;
tls.log2("32&source="+ugc.feed_source+"&stype="+ugc.feed_stype+"&actor="+ugc.feed_actor+"&empty=0");
}
}
if(obj){
tls.log2("33&source="+ugc.feed_source+"&stype="+ugc.feed_stype+"&actor="+ugc.feed_actor+"&empty=0");
}
This.fireEvent("ugcroom_topic_got",obj);
},onError:function(){
tls.log2("34&source="+ugc.feed_source+"&stype="+ugc.feed_stype+"&actor="+ugc.feed_actor+"&empty=1");
This.fireEvent("ugcroom_topic_got_faild");
}});
},startConv:function(_3e1,_3e2){
this.startChat(_3e1,_3e2);
},leave:function(){
this.x=true;
var ugc=this.ugc;
new XN.net.xmlhttp({url:"http://notify."+XN.env.domain+"/quitchat.notify?groups="+ugc.feed_source+"-"+ugc.feed_stype+"-"+ugc.feed_actor});
},broadcast:function(_3e4){
var wp=XN.webpager;
this.fireEvent("before_broadcast",_3e4);
if(_3e4&&_3e4.length>wp.chatWordNum){
_3e4=XN.string.trim(_3e4);
_3e4=_3e4.substring(0,137)+"...";
}
var gsp={from_id:wp.User.id,from_name:wp.User.name,from_pic:wp.User.head,mtime:wp.tools.getTime(),time:wp.tools.getTime(),is_whisper:this.isWhisper,ugc_content:_3e4,feed_actor:this.ugc.feed_actor,feed_source:this.ugc.feed_source,feed_stype:this.ugc.feed_stype,pass:true};
gsp.ugc_content=wp.tools.htmlFilter(_3e4);
this.broadcastGsp(gsp);
gsp.ugc_content=wp.tools.atFilter(_3e4);
webpager.showRealTime(XN.json.build(gsp));
},broadcastGsp:function(_3e7,type){
var This=this;
var gsp=_3e7.ugc_content;
var p={c:gsp,t:this.stypeMap[this.ugc.feed_stype],source:this.ugc.feed_source,owner:this.ugc.feed_actor,replyName:this.replyName?this.replyName:"",replyTo:this.replyTo?this.replyTo:"",isWhisper:this.isWhisper||false};
if(!p.replyTo&&p.t==3){
XN.webpager.tools.log2("status_nobody");
}
if(p.t==3){
XN.webpager.tools.log2("a1");
}
new XN.net.xmlhttp({url:"http://status."+XN.env.domain+"/feedcommentreply.do?from=wp&fromu="+XN.webpager.User.id+"&tou="+p.replyTo+"&source="+p.source+"&fowner="+p.owner+"&t="+p.t+"&stype="+this.ugc.feed_stype,data:XN.array.toQueryString(p),onSuccess:function(r){
var str=r.responseText;
if(!str){
return;
}
if(str=="empty"){
return;
}
var ret=XN.json.parse(r.responseText);
if(ret){
if(ret.code){
This.fireEvent("room_broadcast_error",ret.code,gsp,ret);
}
}
},onComplete:function(){
This.replyName="";
This.replyTo="";
This.isWhisper=false;
}});
}});
})(XN.webpager);
XN.webpager.initBoot=function(){
if(!arguments.callee.init){
var _3ef=document.createElement("div");
_3ef.id="footerbar";
_3ef.innerHTML=["<div id=\"webpager\" class=\"webpager\" style=\"height:30px;\">","<div id=\"wpi_left_bundle\" class=\"panelbarpanels\" style=\"float:left;\"></div>","<div class=\"panelbarpanels\" style=\"float:right;height:30px;border-left:1px solid #B5B5B5;\">","<div id=\"webpager-ad-panel\" class=\"ad-panel panel\"></div>","<div id=\"tasks-panel\" class=\"panel\" style=\"min-width:0;\">","<div id=\"webpager_slider_left\" style=\"display:none;\" class=\"more\"><button class=\"previous\">1</button></div>","<div id=\"tasks-panel-inner\" class=\"windows\" ></div>","<div id=\"webpager_slider_right\" style=\"display:none;\" class=\"more\"><button class=\"next\">2</button></div>","<div id=\"chatroom-panel\"></div>","<div id=\"conv-panel\"></div>","</div>","<div id=\"friends-panel\" class=\"panel\"></div>","<div id=\"notification-panel\" class=\"panel\"></div>","<div id=\"setting-panel\" class=\"panel\"></div>","</div>","</div>"].join("");
var _3f0=$("bottombar");
if(XN.browser.IE){
bodyChildren=document.body.children;
for(var i=0;i<bodyChildren.length;i++){
if(_3f0==bodyChildren[i]){
break;
}
if(i==bodyChildren.length-1){
document.body.appendChild(_3f0);
}
}
}
_3f0.appendChild(_3ef.getElementsByTagName("div")[0]);
this.webpagerDiv=$("webpager");
this.leftBundle=$("wpi_left_bundle");
this.settingDiv=$("setting-panel");
this.friendsDiv=$("friends-panel");
this.notificationDiv=$("notification-panel");
this.taskPanel=$("tasks-panel-inner");
this.taskPanel._oldOffsetHeight=this.taskPanel.offsetHeight;
this.left=$("webpager_slider_left");
this.right=$("webpager_slider_right");
arguments.callee.init=true;
}
};
XN.namespace("webpager.notice");
(function(ns){
ns.getAD=function(){
var ad;
ns.notice.winAD=new ns.Notice("winAD","wa");
ns.notice.winAD1=new ns.Notice("winAD1","wa1");
ns.notice.winAD2=new ns.Notice("winAD2","wa2");
ns.readly(ns.notice.winAD2);
ns.readly(ns.notice.winAD);
ns.readly(ns.notice.winAD1);
ad=ns.notice.winAD;
new XN.net.xmlhttp({url:"http://notify.renren.com/pagerad.js",method:"get",onSuccess:function(r){
var obj=XN.json.parse(r.responseText);
if(obj){
if(obj.ver<0){
ns.noticePool.cancelAll();
return;
}
var _3f6=ns.persistMgr.getWpiCookieBy("v");
if((_3f6-0)<obj.ver){
ns.noticePool.reset();
ns.persistMgr.setWpiCookie("v",obj.ver,360);
}
ns.notice.winAD.data=obj.ad1;
ns.notice.winAD1.data=obj.ad1;
ns.notice.winAD2.data=obj.ad1;
ns.notice.winAD.doReady();
ns.notice.winAD1.doReady();
ns.notice.winAD2.doReady();
}
}});
};
})(XN.webpager);
XN.webpager.init=function(){
window.__logEvents=false;
var xw=XN.webpager;
if(xw.inited){
return;
}
_18.log1("webpager \u5f00\u59cb\u521d\u59cb\u5316...");
this.initBoot();
_18.log1("webpager \u6240\u9700\u8981\u7ed3\u6784\u6784\u9020\u5b8c\u6bd5");
this.tasks=new XN.webpager.ConvGroup(this.taskPanel);
this.friendsGroup=new XN.webpager.windowGroup($("friends-panel"));
this.settingGroup=new XN.webpager.windowGroup($("setting-panel"));
this.notifyGroup=new XN.webpager.windowGroup($("notification-panel"));
window.tasks=this.tasks;
window.setting=XN.webpager.friendsGroup;
var _3f8=xw.persistMgr.getWpiCookieBy("wp_save");
if(!_3f8){
xw.persistMgr.setWpiCookie("wp_save","");
}
XN.webpager.notifyBox.init();
_18.log1("webpager \u901a\u77e5\u7ba1\u7406\u5668(model)\u521d\u59cb\u5316\u5b8c\u6bd5");
XN.webpager.settingGroup.add(new XN.webpager.settingsWindow());
_18.log1("webpager \u8bbe\u7f6e(setting)\u521d\u59cb\u5316\u5b8c\u6bd5");
this.notifyWin=new XN.webpager.notifyWindow({model:XN.webpager.notifyBox});
XN.webpager.notifyGroup.add(this.notifyWin);
_18.log1("webpager \u901a\u77e5\u7ba1\u7406\u5668(view)\u521d\u59cb\u5316\u5b8c\u6bd5");
var _3f9=new XN.webpager.friendsWindow({model:XN.webpager.friendbook});
XN.webpager._friendbook=_3f9;
XN.webpager.friendsGroup.add(_3f9);
_18.log1("webpager \u597d\u53cb\u5217\u8868\u521d\u59cb\u5316\u5b8c\u6bd5");
XN.webpager.winSlider.init();
_18.log1("webpager \u7a97\u53e3\u5e03\u5c40\u7ba1\u7406\u5668(winSlider)\u521d\u59cb\u5316\u5b8c\u6bd5");
XN.webpager.pagerTimer.init();
_18.log1("webpager \u8ba1\u65f6\u5668\u521d\u59cb\u5316\u5b8c\u6bd5");
XN.webpager.mgr.init();
_18.log1("webpager \u7cfb\u7edf\u7ba1\u7406\u5668(\u8fde\u63a5\u7ba1\u7406\u7b49)\u521d\u59cb\u5316\u5b8c\u6bd5");
xw.BlingMgr.init();
_18.log1("webpager \u95ea\u70c1\u7ba1\u7406\u5668\u521d\u59cb\u5316\u5b8c\u6bd5");
xw.RoomKeeper.init();
XN.webpager.persistMgr.init();
_18.log1("webpager \u6301\u4e45\u5316\u7ba1\u7406\u5668\u521d\u59cb\u5316\u5b8c\u6bd5");
this.bindEvent();
_18.log1("webpager \u4e8b\u4ef6\u7ed1\u5b9a\u5b8c\u6bd5");
if(webpager.imRunning||!webpager.storageOk){
XN.webpager.mgr.disConnect(false);
}
var _3fa;
var _3fb=$element("div");
function showBackTip(){
_3fa&&clearTimeout(_3fa);
_3fb.show();
_3fa=_12(function(){
hideBackTip();
},4000);
}
function hideBackTip(){
_3fb.hide();
clearTimeout(_3fa);
}
_3fb.style.position="absolute";
_3fb.style.bottom="35px";
_3fb.style.right="0px";
_3fb.setContent("<div style=\"padding:5px;border:1px solid #d7b013;background:#fff9d7\"><img src=\"http://s.xnimg.cn/imgpro/icons/back_to_top.gif\"/>\u70b9\u51fb\u6b64\u6309\u94ae\u8fd4\u56de\u9875\u9762\u9876\u90e8<div id=\"wpi_back_to_top_arrow\" style=\"background:url(http://s.xnimg.cn/imgpro/arrow/tip-arrow-down.png?ver=2) no-repeat;height:6px;width:11px;position:absolute;bottom:-5px;right:25px;overflow:hidden;\"></div></div>");
var _3fc=$element("div");
_3fb.hide();
XN.webpager.webpagerDiv.appendChild(_3fb);
XN.webpager.addEvent("view_webpager_scroll_common",function(){
hideBackTip();
});
this.settingGroup.addEvent("view_group_has_active",function(){
hideBackTip();
});
this.friendsGroup.addEvent("view_group_has_active",function(){
hideBackTip();
});
var ua=navigator.userAgent;
var _3fe=ua.indexOf("Windows")!=-1;
var _3ff=new XN.webpager.WidgetGroup($("webpager-ad-panel"));
if(_3fe){
var _400="http://im.renren.com/desktop/ver8/rrsetup.exe?f=wpw8-2";
var _401=[["\u4f60\u7684ta\u5728\u5fd9\u5565?\u4eba\u4eba\u684c\u9762,\u65f6\u523b\u638c\u63e1\uff01",_400],["\u4eba\u4eba\u684c\u9762\u8bb0\u4e8b\u672c\uff0c\u5de5\u4f5c\u7410\u4e8b\u968f\u65f6\u8bb0\uff01",_400],["\u4eba\u4eba\u684c\u9762\uff1a\u5c0f\u7a97\u770b\u89c6\u9891\uff0c\u4e0a\u73ed\u4e5f\u5a31\u4e50",_400],["\u4eba\u4eba\u684c\u9762\u8d85\u795e\u901f\uff01\u79d2\u56deTa\u7684\u65b0\u72b6\u6001",_400],["\u9ad8\u8003\u6cc4\u9898?\u96f6\u5206\u4f5c\u6587?\u4eba\u4eba\u684c\u9762\u5148\u77e5\u9053",_400]];
if(window.imengine&&window.imengine.ads){
_401=window.imengine.ads;
var hst=location.host;
hst=hst.substring(0,hst.indexOf("."));
if(hst&&(hst=="app"||hst=="apps")){
_401=window.imengine.game_ads;
}
}
var _403=_401[Math.floor(Math.random()*_401.length)];
var _404=new XN.webpager.Widget({strContent:"<div class=\"ad-button\"><a id=\"wp_ad\" target=\"_blank\" style=\"background-image:url("+_403[2]+");text-indent:7px;color:#333;height:21px;line-height:21px;margin-top:5px;overflow:hidden;\" href=\""+_403[1]+"\">"+_403[0]+"</a></div>"});
_3ff.add(_404);
if(tasks.items.length){
_3ff.container.hide();
}
var _405=true;
this.tasks.addEvent("view_a_window_added",function(){
if(_405){
_405=false;
(!webpager.imRunning)&&XN.webpager.getAD();
}
_3ff.hide();
});
this.tasks.addEvent("view_no_windows",function(){
_3ff.container&&_3ff.container.show();
});
}else{
_3ff.container&&_3ff.container.hide();
}
XN.webpager.fireEvent("webpager_loaded");
XN.webpager.inited=true;
_18.log1(" -------------------------------------- ");
_18.log1("webpager \u521d\u59cb\u5316\u5b8c\u6bd5! \u5927\u529f\u544a\u6210!");
_18.log1(" -------------------------------------- ");
if(window.webpager){
webpager.iamReady&&webpager.iamReady(XN.webpager);
}
if(XN.webpagerUIReadyQ){
for(var ii=0;ii<XN.webpagerUIReadyQ.length;ii++){
XN.webpagerUIReadyQ[ii].call(this);
}
}
XN.webpager.tools.log2("b1");
XN.webpager.doReady();
};
XN.event.enableCustomEvent(XN.webpager);
XN.webpager.bindEvent=function(){
var This=this;
XN.event.addEvent(document,"click",function(e){
e=e||window.event;
if(e.button!=0){
return;
}
This.hideAllWin();
});
this.webpagerDiv.addEvent("click",function(e){
e=e||window.event;
var ele=e.srcElement||e.target;
if(e.stopPropagation){
e.stopPropagation();
}else{
e.cancelBubble=true;
}
});
this.addEvent("webpager_loaded",function(){
XN.webpager.winSlider.resetPanelWidth();
});
if(XN.browser.IE6){
this.pagerTimer.addEvent("webpager_tools_timer",function(){
This.winSlider.resizeCheck();
});
}
};
window.talkto=function(id,name,fn,_40e){
_12(function(){
var wp=XN.webpager;
var fri=wp.friendbook.map[id+""];
if(!fri){
wp.friendbook.fetOnlineFriend(false,function(){
if(wp.friendbook.map[id+""]){
wp.RoomKeeper.findConv(wp.friendbook.map[id+""],_40e);
}else{
XN.DO.showMessage("\u62b1\u6b49\uff0c\u8be5\u7528\u6237\u5f53\u524d\u4e0d\u5728\u7ebf\u6216\u4e0d\u662f\u4f60\u7684\u597d\u53cb");
}
});
return;
}
var room=wp.RoomKeeper.findConv(fri,_40e);
if(fn){
fn.call(wp.friendbook,room);
}
},0);
};
window.noUI=function(_412,_413){
XN.webpager.RoomKeeper.makeBackEndGroupRoom(_412,_413);
};
window.openGroup=function(_414,_415){
var _416=XN.webpager.RoomKeeper;
var rm=_416.hideRoom[_414];
if(!rm){
rm=_416.doAddConv({id:_414,roomId:_414,roomName:_415},true,3);
window.testGroup=rm;
try{
_12(function(){
rm.startChat(true,true);
},500);
}
catch(e){
}
return {ui:XN.webpager.tasks.getWin(_414),model:rm};
}
_416.buildGroupRoom2(rm,true,function(){
rm.startChat(true,true);
});
return {ui:XN.webpager.tasks.getWin(_414),model:rm};
};
var t=document.getElementsByTagName("title")[0];
window.showshow=function(){
var p=XN.webpager.winSlider;
_18.log1(p.leftHideStack.length+" "+p.showQueue.length+" "+p.rightHideStack.length);
};
window.showBling=function(){
XN.webpager.MessagerProxy.onRecvNotify({icon:"ab",content:"wcdsdf"});
};
if(XN.webpager.debug){
window.testGroup=function(){
var p={from:"350747701@group.talk.xiaonei.com/ss\u6797\u60e0\u534e(0)-250805736",to:"250805736",content:"{type:\"groupchat\",info:{roomid:\"350747701\",roomname:\"xoxoxoxoxo\",userid:\"250805736\"}, chat:\"\u6d4b\u8bd5\"}"};
var rm=XN.webpager.RoomKeeper.throwToGroupChat(p);
};
window.testGroup2=function(){
var p={from:"350747701@group.talk.xiaonei.com/ss\u6797\u60e0\u534e(0)-250805736",to:"250805736",content:"{type:\"groupchat\",info:{roomid:\"350747701\",roomname:\"xoxoxoxoxo\",userid:\"250805736\"}, chat:\"xoxoxoxo\u6d4b\u8bd5\"}"};
var rm=XN.webpager.RoomKeeper.throwToGroupChat(p);
};
}
extendObject($,{clearRange:function(){
try{
document.selection?document.selection.empty():getSelection().removeAllRanges();
}
catch(e){
}
},text:function(node){
var _41f=node.childNodes;
for(var i=0,text="";i<_41f.length;i++){
if(_41f[i].nodeType==3){
text+=_41f[i].nodeValue;
}
}
return text;
},css:function(ele,_423){
if(!ele){
return;
}
for(var i in _423){
ele.style[i]=_423[i];
}
},clear:function(node){
while(node&&node.firstChild){
node.removeChild(node.firstChild);
}
},append:function(node,_427){
if(_427.tagName){
node.appendChild(_427);
}else{
var temp=document.createElement("div");
temp.innerHTML=_427;
while(temp.hasChildNodes()){
node.appendChild(temp.firstChild);
}
}
},mouse:function(e){
e=e||event;
var x=e.pageX||(e.clientX+XN.EVENT.scrollLeft());
var y=e.pageY||(e.clientY+XN.EVENT.scrollTop());
return {x:x,y:y};
}});
$.wpi=$.wpi||{};
extendObject($.wpi,{parseMenuItem:function(_42c){
var _42d=_42c.getElementsByTagName("a")[0];
return {id:_42d.name,name:$.text(_42d),href:_42d.href,icon:_42c.getElementsByTagName("img")[0].src,target:_42d.target};
},parseShortCut:function(_42e){
return {id:_42e.name,name:_42e.title,href:_42e.href,icon:_42e.getElementsByTagName("img")[0].src,target:_42e.target};
},createShortCut:function(item){
var data=$.wpi.parseMenuItem(item);
data.href=this.setUrlParam(data.href,"origin",(this.getBaseCode()*100+93));
return "<li><a href=\""+data.href+"\" title=\""+data.name+"\" name=\""+data.id+"\" target=\""+data.target+"\" style=\"padding-top:4px;padding-bottom:2px;\"><img src=\""+data.icon+"\" class=\"icon\" /><span class=\"tooltip\"><nobr>"+data.name+"</nobr><span class=\"tooltip-arrow\"></span></span></a></li>";
},createMenuItem:function(){
var _431=document.createElement("dd");
var data=arguments[0].nodeType?$.wpi.parseShortCut(arguments[0]):arguments[0];
data.href=this.setUrlParam(data.href,"origin",(this.getBaseCode()*100+92));
_431.className="move";
_431.innerHTML="<a href=\""+data.href+"\" name=\""+data.id+"\" target=\""+data.target+"\"><img src=\""+data.icon+"\" />"+data.name+"<span class=\"del-handle\"></span></a>";
return _431;
},createHistroyItem:function(data){
data.href=this.setUrlParam(data.href,"origin",(this.getBaseCode()*100+91));
return "<dd><a href=\""+data.href+"\" name=\""+data.id+"\" target=\""+data.target+"\"><img src=\""+data.icon+"\" />"+data.name+"</a></dd>";
},createStowItem:function(data){
return "<div class=\"panelbarbutton\"><a href=\""+data.href+"\" class=\"commend stow\" title=\""+data.name+"\" name=\""+data.id+"\" target=\""+data.target+"\"><img src=\""+data.icon+"\" class=\"icon\" /><img class=\"plus bauble plus-bullet\" src=\"http://a.xnimg.cn/imgpro/icons/green-plus-bullet.gif\" /> \u6536\u85cf"+data.name+"</a></div>";
},setUrlParam:function(url,_436,_437){
var reg=new RegExp("\\b"+_436+"=.*?((?=[&])|$)");
if(reg.test(url)){
return url.replace(reg,_436+"="+_437);
}else{
var has=url.indexOf("?")!=-1;
return url+(has?"&":"?")+_436+"="+_437;
}
},serial:[],ajaxAddApp:function(id){
if(this.serial.length<6){
this.serial.push(id);
}else{
var temp=this.serial.slice(0,5);
temp.push(id);
this.serial=temp.concat(this.serial.slice(5));
}
new XN.NET.xmlhttp({url:"http://apps."+XN.env.domain+"/menu/addBookmark.do",method:"post",data:"app_id="+id});
},ajaxDelApp:function(id){
for(var i=0;i<this.serial.length;i++){
if(this.serial[i]==id){
this.serial.splice(i,1);
break;
}
}
new XN.NET.xmlhttp({url:"http://apps."+XN.env.domain+"/menu/removeBookmark.do",method:"post",data:"app_id="+id});
},ajaxSerialApp:function(sn){
if(sn.join(",")!=this.serial.join(",")){
this.serial=sn;
new XN.NET.xmlhttp({url:"http://apps."+XN.env.domain+"/menu/reorderBookmark.do",method:"post",data:"app_ids="+XN.JSON.build(sn)});
}
},getBaseCode:function(){
var list={};
list["home."+XN.env.domain]=1;
list["www."+XN.env.domain+"/profile.do"]=2;
list["msg."+XN.env.domain]=3;
list["apps."+XN.env.domain]=5;
list["game."+XN.env.domain]=5;
list["app."+XN.env.domain]=7;
list["app."+XN.env.domain+"/apps/editapps.do"]=8;
list["app."+XN.env.domain+"/apps/application.do"]=9;
list["app."+XN.env.domain+"/app/apps/list"]=28;
return list[location.hostname+location.pathname]||list[location.hostname]||0;
}});
(function(){
$.effect=$.effect||{};
var _440=$.effect.MoveEffect=function(_441){
this.config=_441;
this.element=$(_441.element);
this.nodeStart={x:0,y:0};
this.mouseStart={x:0,y:0};
this.shadow=null;
this.activeItem=null;
if(XN.ELEMENT.getStyle(this.element,"position")=="static"){
$.css(this.element,{"position":"relative"});
}
this.init();
};
_440.prototype={init:function(){
var that=this;
this.moveWrap=function(e){
var pos=$.mouse(e);
if((pos.x-that.mouseStart.x)==0&&(pos.y-that.mouseStart.y)==0){
return;
}
if(that.config.startMove){
that.config.startMove();
}
that.moveHandler(e);
};
this.repeaseWrap=function(e){
that.releaseHandler(e);
};
$(this.element).addEvent("mousedown",function(e){
e=e||window.event;
that.activeItem=that.getActiveItem(e);
if(that.activeItem==null){
return;
}
that.mouseStart=$.mouse(e);
that.nodeStart={x:that.activeItem.offsetLeft,y:that.activeItem.offsetTop};
$(document).addEvent("mousemove",that.moveWrap).addEvent("mouseup",that.repeaseWrap);
XN.BROWSER.IE?(e.returnValue=false):e.preventDefault();
return false;
});
},getActiveItem:function(e){
e=e||window.event;
var obj=e.target||e.srcElement;
while(obj.parentNode!=this.element){
obj=obj.parentNode;
}
return obj.nodeType==1?obj:null;
},moveHandler:function(e){
e=e||window.event;
this.createShadow();
$.clearRange();
var top=this.nodeStart.y+($.mouse(e).y-this.mouseStart.y);
var left=this.nodeStart.x+($.mouse(e).x-this.mouseStart.x);
if(!this.activeItem.parentNode||this.config.outLimit(top,left,this.shadow.offsetHeight,this.shadow.offsetWidth)){
this.releaseHandler();
}else{
this.moveShadow(top,left);
this.serialize(top,left);
}
},createShadow:function(){
if(this.shadow==null){
this.shadow=this.activeItem.cloneNode(true);
$(this.shadow).addClass("movemirror");
$.css(this.shadow,{top:this.nodeStart.y+"px",left:this.nodeStart.x+"px",width:this.activeItem.offsetWidth+"px",height:this.activeItem.offsetHeight+"px"});
$.append(this.element,this.shadow);
}
},releaseHandler:function(e){
$(document).delEvent("mousemove",this.moveWrap).delEvent("mouseup",this.repeaseWrap);
if(this.shadow){
$(this.shadow).remove();
this.shadow=null;
if(typeof this.config.release=="function"){
this.config.release(this.activeItem);
}
}
},moveShadow:function(top,left){
$.css(this.shadow,{top:top+"px",left:left+"px"});
},serialize:function(top,left){
var _451=this.config.getIndex(top,left,this.activeItem.offsetHeight,this.activeItem.offsetWidth);
if(_451>=0){
var list=this.config.getChilds();
if(list[_451]){
this.element.insertBefore(this.activeItem,list[_451]);
}else{
$.append(this.element,this.activeItem);
}
}
}};
var _453=null;
var _454=null;
var _455=null;
var _456=null;
var _457=null;
var _458=null;
function sendNewSerial(){
var _459=_453.getElementsByTagName("dd");
var sn=[];
for(var i=0;i<_459.length;i++){
sn.push(parseInt(_459[i].getElementsByTagName("a")[0].name));
}
$.wpi.ajaxSerialApp(sn);
}
function createAppMove(){
_457=new _440({element:_453,getChilds:function(){
return _453.getElementsByTagName("dd");
},getIndex:function(top,left,offH,offW){
return Math.ceil(top/offH);
},release:function(){
$.clear(_456);
var list=_453.getElementsByTagName("dd");
for(var i=0;i<list.length&&i<6;i++){
$.append(_456,$.wpi.createShortCut(list[i]));
}
var _462=_453.getElementsByTagName("dt")[0];
if(!_462){
_462=document.createElement("dt");
}
_453.insertBefore(_462,list[6]||null);
$.css(_462,{display:(wpiMenuInfo.favoriteMenu.length>6?"block":"none")});
$.css($("wpi_collectionTitle"),{borderBottom:(list[0]?"1px solid #E3EEF9":"none")});
var _463=_455.getElementsByTagName("img")[0];
if(_463){
for(var i=0;i<list.length&&i<6;i++){
if(list[i].getElementsByTagName("img")[0].src==_463.src){
_455.innerHTML="";
break;
}
}
}
sendNewSerial();
},outLimit:function(top,left,offH,offW){
return (top<-offH||top>_453.offsetHeight);
}});
}
function createCutMove(){
_458=new _440({element:_456,getChilds:function(){
return _456.getElementsByTagName("li");
},getIndex:function(top,left,offH,offW){
return Math.ceil(left/offW);
},release:function(){
var list=_456.getElementsByTagName("a");
var _46d=_453.getElementsByTagName("dd");
for(var i=0;i<list.length;i++){
_453.replaceChild($.wpi.createMenuItem(list[i]),_46d[i]);
}
sendNewSerial();
},outLimit:function(top,left,offH,offW){
return (left<-offW||left>_456.offsetWidth);
}});
}
function bindEvents(){
_453=$("wpi_collectionApps");
_455=$("wpi_addCollection");
_456=$("wpi_shortCutsPanel");
_454=$("wpi_hitoryPanel");
createAppMove();
createCutMove();
_455.addEvent("click",function(e){
var app=_455.getElementsByTagName("a")[0];
if(app){
$.wpi.addApp($.wpi.parseShortCut(app));
}
XN.EVENT.stop(e||event);
});
$.wpi.addApp=function(data){
var menu=null;
var _477=_453.getElementsByTagName("dd");
for(var i=0;i<_477.length;i++){
if(_477[i].getElementsByTagName("a")[0].getAttribute("name")==data.id){
menu=_477[i];
break;
}
}
if(menu!=null&&i<6){
return;
}
if(menu==null){
menu=$.wpi.createMenuItem(data);
$.wpi.ajaxAddApp(wpiMenuInfo.currentNorepeat[0].id);
}
_453.insertBefore(menu,_477[5]||null);
_457.config.release();
var _479=XN.dom.getElementsByClassName("icon",_455)[0];
if(_479&&_479.src==data.icon){
_455.innerHTML="";
}
};
_453.addEvent("click",function(e){
e=e||window.event;
var obj=e.target||e.srcElement;
if(obj.className=="del-handle"){
while(obj.tagName!="DD"){
obj=obj.parentNode;
}
var _47c=document.createElement("div");
_47c.innerHTML="<tt class=\"del-tip\">\u5df2\u79fb\u51fa\u6536\u85cf</tt><tt class=\"del-reroll\">\u64a4\u9500</tt>";
$.css(obj.getElementsByTagName("a")[0],{"display":"none"});
var _47d=_12(function(){
if(obj&&obj.parentNode){
$.wpi.ajaxDelApp(obj.getElementsByTagName("a")[0].name);
obj.parentNode.removeChild(obj);
_457.config.release();
}
},4000);
_47c.timer=_47d;
$.append(obj,_47c);
XN.BROWSER.IE?(e.returnValue=false):e.preventDefault();
return false;
}else{
if(obj.className=="del-reroll"){
clearTimeout(obj.parentNode.timer);
var app=obj.parentNode.parentNode;
$.css(app.getElementsByTagName("a")[0],{"display":"block"});
$.css(obj.parentNode,{display:"none"});
_12(function(){
app.removeChild(obj.parentNode);
},0);
XN.BROWSER.IE?(e.returnValue=false):e.preventDefault();
return false;
}
}
});
}
var root=null;
function createStruts(){
root=$("webpager").getElementsByTagName("div")[0];
root.innerHTML="";
$.append(root,["<div class=\"panel\" id=\"apps-panel\"></div>","<div class=\"panel\"><div class=\"button-widget\"><ul id=\"wpi_shortCutsPanel\" class=\"icon\"></ul></div></div>","<div class=\"panel\" id=\"wpi_addCollection\"></div>","<div class=\"panel\" id=\"wpi_extendGroup\"></div>"].join(""));
var _480=new XN.webpager.EmptyWindow({strContent:["<article id=\"wpi_menuPanel\" class=\"app-list\">","<section>","<dl class=\"apps\">","<dt>\u6700\u8fd1\u4f7f\u7528</dt>","</dl>","<dl class=\"apps\" id=\"wpi_hitoryPanel\"></dl>","<dl class=\"apps\">","<dt style=\"border-bottom: 1px solid #E3EEF9;\" id=\"wpi_collectionTitle\">\u6211\u7684\u6536\u85cf<a class=\"edit\" href=\"http://app."+XN.env.domain+"/apps/editapps.do?origin="+($.wpi.getBaseCode()*100+90)+"\">\u7f16\u8f91</a></dt>","</dl>","<dl class=\"apps\" style=\"position: relative;\" id=\"wpi_collectionApps\"></dl>","</section>","<footer><strong>\u62d6\u52a8\u8fdb\u884c\u6392\u5e8f</strong> <a class=\"more\" href=\"http://app."+XN.env.domain+"/app/apps/list?origin="+($.wpi.getBaseCode()*100+90)+"\">\u6d4f\u89c8\u66f4\u591a\u5e94\u7528</a></footer>","</article>"].join(""),strButton:["<img height=\"16\" width=\"16\" src=\"http://a.xnimg.cn/imgpro/chat/app_menu_logo.png\" class=\"icon\" />"," <strong id=\"wpi_togMenuPanel\" class=\"title\">\u6211\u7684\u5e94\u7528</strong>"].join("")});
var _481=new XN.webpager.windowGroup("apps-panel");
_481.add(_480);
var _482=new XN.webpager.EmptyWindow({strButton:[""," <strong id=\"wpi_renrenWidget\" class=\"title\"><a id=\"wpi_rrWidget_trigger\" href=\"#\" style=\"text-decoration:none;\"><img height=\"16\" width=\"16\" src=\"http://s.xnimg.cn/imgpro/icons/miniwidget_icon.gif\" class=\"icon\" /></a></strong>"].join(""),activeUnable:true});
try{
var _483=["250805736","80625915","230961237","200208111","238995479","225627156","142525482","200000521","200000032","85432256","236851580","236851580","352357135","200012179","200163394","200208111","276427555","200217048","39839252","289478303","227775463","354552371","220805438","236851580","232686677","142443436","245036755","354552371","318504593","81120"];
var _484=(function(){
if(parseInt(XN.user.id)%10==6||XN.array.include(_483,XN.user.id)){
return true;
}
return false;
})();
if(location.href.indexOf("http://www.")==0&&_484){
extendGroup.add(_482);
}
}
catch(e){
XN.webpager.tools.logExpt("c05",e);
}
}
function loadMiniRadio(){
var _485=new XN.webpager.windowGroup("wpi_extendGroup");
_485.container.innerHTML="<div id=\"webpager-miniradio\" style=\"width:121px\"></div>";
XN.loadFiles(["http://s.xnimg.cn/apps/radio/js/radio-home.js","http://s.xnimg.cn/apps/radio/css/radio-home.css"],function(){
_18.log1("mini\u7535\u53f0\u8d44\u6e90\u52a0\u8f7d\u5b8c\u6210,\u51c6\u5907\u521d\u59cb\u5316");
XN.radio.home.init("","webpager-miniradio");
});
}
function createRecentMenus(){
$("wpi_togMenuPanel").addEvent("click",function(){
if(!createRecentMenus.init){
for(var i=0;i<wpiMenuInfo.recentNorepeat.length&&i<9;i++){
$.append(_454,$.wpi.createHistroyItem(wpiMenuInfo.recentNorepeat[i]));
}
createRecentMenus.init=true;
}
});
}
function createFavoriteMenus(){
for(var i=0;i<wpiMenuInfo.favoriteMenu.length&&i<6;i++){
$.wpi.serial.push(wpiMenuInfo.favoriteMenu[i].id);
$.append(_453,$.wpi.createMenuItem(wpiMenuInfo.favoriteMenu[i]));
}
$("wpi_togMenuPanel").addEvent("click",function(){
if(!createFavoriteMenus.init){
for(var i=6;i<wpiMenuInfo.favoriteMenu.length;i++){
$.wpi.serial.push(wpiMenuInfo.favoriteMenu[i].id);
$.append(_453,$.wpi.createMenuItem(wpiMenuInfo.favoriteMenu[i]));
}
createFavoriteMenus.init=true;
}
});
}
function createShortcuts(){
_457.config.release();
}
function createStowShortcut(){
for(var i=0;i<wpiMenuInfo.currentNorepeat.length;i++){
$.append(_455,$.wpi.createStowItem(wpiMenuInfo.currentNorepeat[i]));
}
}
$.wpi.initApp=function(){
if(!window.wpiMenuInfo){
return;
}
createStruts();
if(XN.pageId&&XN.pageId=="home"){
_12(loadMiniRadio);
}
bindEvents();
wpiMenuInfo.recentNorepeat=wpiMenuInfo.recentMenu.slice(0,9);
for(var i=0;i<wpiMenuInfo.favoriteMenu.length;i++){
for(var j=0;j<wpiMenuInfo.recentNorepeat.length;j++){
if(wpiMenuInfo.favoriteMenu[i].id==wpiMenuInfo.recentNorepeat[j].id){
wpiMenuInfo.recentNorepeat.splice(j,1);
break;
}
}
}
wpiMenuInfo.currentNorepeat=wpiMenuInfo.currentApp.slice(0);
var _48c=wpiMenuInfo.currentNorepeat;
for(var i=0;i<wpiMenuInfo.favoriteMenu.length&&i<6;i++){
for(var j=0;j<_48c.length;j++){
if(wpiMenuInfo.favoriteMenu[i].id==_48c[j].id){
_48c.splice(j,1);
break;
}
}
}
createRecentMenus();
createFavoriteMenus();
createShortcuts();
createStowShortcut();
Sizzle("#wpi_menuPanel > section")[0].style.overflow="hidden";
return $.wpi;
};
$.wpi.showApp=function(){
if(!window.wpiMenuInfo){
return;
}
$.css(root,{display:"block"});
return $.wpi;
};
$.wpi.hideApp=function(){
if(!window.wpiMenuInfo){
return;
}
$.css(root,{display:"none"});
return $.wpi;
};
})();
XN.namespace("webpager.plugins");
XN.webpager.plugs=function(_48d,fn){
var _48f=XN.namespace(_48d);
fn.call(_48f,_48f,XN.webpager,webpager);
};
XN.webpager.plugs("webpager.plugins.groupTalkGuide",function(ns,wpUI,_492){
wpUI.addEvent("view_a_window_actived",function(win){
if(win.makeAAtendee&&!ns.hasGuide){
win.guideBling=new XN.webpager.Bling({fn0:function(){
win.input.style.border="";
},fn1:function(){
win.input.style.border="3px dashed #EB8828";
},timeInterv:200});
win.guideBling.addEvent("view_bling_stoped",function(){
win.input.style.border="";
});
window.win=win;
$(win.input.parentNode).appendHTML(["<div class=\"miniGroup-guide\" style=\"bottom: -25px;left:-270px;position:absolute;background:#CCC;border:1px solid #888;display:none;\">","<span class=\"g-tip-right clearfix\">","<a href=\"javascript:;\" class=\"close\">\u5173\u95ed</a>","<h3>\u5728\u7ebf\u7fa4\u804a</h3>","<p class=\"f-888\">\u7206\u6599\u516b\u5366\u3001\u7740\u6025\u996d\u5c40\u3001\u79c1\u5bc6\u8bdd\u9898\uff0c\u6765\u8fd9\u91cc\uff01<br>\u4e0d\u5728\u7fa4\u7684\u90a3\u4e9b\u5929\uff0c\u8fd8\u53ef\u4ee5\u7ffb\u770b\u5927\u5bb6\u7684\u804a\u5929\u8bb0\u5f55\u3002<br>\u5fc3\u52a8\u4e86\u5417\uff1f\u8bb0\u5f97\u5e38\u70b9\u53f3\u4e0a\u65b9\u7684\u201c\u5f00\u59cb\u804a\u5929\u201d\u5427~</p>","<span class=\"steps\">2/3 <a href=\"javascript:;\" class=\"gray-btn view-class j-next-step \">\u4e0b\u4e00\u6b65 <img src=\"http://s.xnimg.cn/imgpro/arrow/arrow-lightgray.gif\"></a></span><span class=\"tip-bg\"></span></span>","</div>"].join(""));
ns.hasGuide=true;
var _494=Sizzle("div.miniGroup-guide",win.element)[0];
win.guide=$(_494);
win.hideGuide=function(){
win.guide.hide();
};
win.showGuide=function(){
win.guide.show();
};
win.startGuideBling=function(){
win.guideBling.start();
};
win.stopGuideBling=function(){
win.guideBling.stop();
};
}
});
});
XN.namespace("webpager.plugins.WebTalk");
(function(ns){
var win,_497="toolbar=no,location=no,directories=no,menubar=no,resizable=yes,status=yes,scrollbars=no,width=800,height=360,left=100,top=10";
var name="webTalkWin";
ns.receiveWebTalk=function(){
win=window.open("http://webtalk.renren.com/webtalk?uid=0#gun",name,_497);
if(win){
win.focus();
}
};
ns.startWebTalk=function(id){
win=window.open("http://webtalk.renren.com/webtalk?uid="+id+"#gun",name,_497);
if(win){
win.focus();
}
};
XN.webpager.plugs("webpager.plugins.WebTalk",function(ns,wpUI,_49c){
wpUI.addEvent("view_friendList_click",function(ta){
if(ta.getAttribute("cam")){
ns.startWebTalk(ta.getAttribute("calleeId"));
}
});
});
})(XN.webpager.plugins.WebTalk);
XN.namespace("webpager.plugins.userServe");
(function(ns){
var _49f="365734329";
if(!XN.user.isGuide||XN.user.id==_49f){
return;
}
if(!XN.user.stage||parseInt(XN.user.stage)!=10){
return;
}
new XN.net.xmlhttp({url:"http://notify.renren.com/wpi/getuserinfo.do?targetuser="+_49f,onSuccess:function(r){
var _4a1=XN.json.parse(r.responseText);
var _4a2=parseInt(_4a1.targetuseronlinetype);
var obj={id:_4a1.targetuserid,name:_4a1.targetusername,doing:"",status:_4a2,tiny:"http://hdn.xnimg.cn/photos/"+_4a1.targetusertiny};
if(!_4a2){
return;
}
XN.webpager.plugs("webpager.plugins.userServe",function(ns,ui,_4a6){
ui.friendbook.addEvent("friendbook_before_update_friends",function(ret){
var isIn=false;
var f;
for(var i=0;i<ret.friends.length;i++){
f=ret.friends[i];
if(f.id==_49f){
isIn=true;
break;
}
}
if(!isIn){
ret.friends.unshift(obj);
ui._friendbook.updateCount(++ret.onlineFriendsCount);
}
});
ui.friendbook.addEvent("friendbook_before_count_got",function(_4ab,ret){
ui._friendbook.updateCount(++ret.onlineFriendsCount);
});
XN.webpager.ready(function(){
ui.friendbook.map[_4a1.targetuserid]=obj;
_12(function(){
talkto(obj.id,obj.name,function(rm){
if(_4a2){
var win=ui.tasks.getWin(rm.getId());
var bl=new XN.webpager.Bling({fn0:function(){
win&&win.disHlight();
},fn1:function(){
win&&win.hlight();
},timeInterv:500});
bl.start();
_12(function(){
bl.stop();
bl.fn1();
},3000);
}
},false);
},3000);
});
});
}});
})(XN.webpager.plugins.userServe);
XN.namespace("webpager.plugins.offlineMessger");
(function(ns){
XN.webpager.plugs("webpager.plugins.offlineMessger",function(ns,wpUI,_4b3){
function showTip(num){
wpUI.ready(function(){
wpUI.notifyWin.toreadNum.innerHTML=num;
wpUI.notifyWin.model.toread=num;
wpUI.notifyWin.tipBling.start();
wpUI.notifyWin.showTip();
webpager.setItem("unread",num);
});
}
var num=webpager.getItem("unread");
if(num){
num=parseInt(num);
}
if(num){
showTip(num);
}
_4b3.addEvent("other_got",function(m){
if(!m){
return;
}
var obj=XN.json.parse(m.content);
if(obj.type!="info_unread_count"){
return;
}
wpUI.ready(function(){
showTip(obj.count);
});
});
wpUI.ready(function(){
wpUI.notifyWin.addEvent("ua_open_window",function(){
webpager.setItem("unread","");
});
});
});
})(XN.webpager.plugins.WebTalk);
XN.namespace("renrenWidget");
XN.dom.ready(function(){
var id="widgetContainer";
var _4b9=$element("div");
var _4ba=document.documentElement||document.body;
_4b9.id="widget";
document.body.appendChild(_4b9);
if(XN.browser.IE6){
document.body.style.height="100%";
}
var _4bb=false;
function luanchRenrenWidget(){
_4b9.isShow=true;
_4bb=true;
function hideDash(){
var _4bc=$(id);
_4b9.isShow=false;
_4bc.style.width=0;
if(XN.browser.IE6){
_4ba.style.overflow="";
}
}
function removeDash(){
_4bb=false;
var _4bd=$(id);
_4bd.remove();
}
function doHideDash(){
var _4be=$(id);
_4be.style.width=0;
}
function showDash(){
try{
var _4bf=$(id);
_4b9.isShow=true;
_4bf.style.width="100%";
_4bf.show("fadeIn");
if(XN.browser.IE6){
_4ba.style.overflow="hidden";
}
}
catch(e){
XN.webpager.tools.logExpt("c06",e);
}
}
var _4c0={targetUrl:"http://a.xnimg.cn/swf/renrenWidget/main/main.swf"};
var _4c1={wmode:"transparent",allowScriptAccess:"always"};
var _4c2;
if(XN.browser.Gecko){
_4c2="Gecko";
}else{
if(XN.browser.WebKit){
_4c2="WebKit";
}else{
if(XN.browser.IE){
_4c2="IE";
}
}
}
var name=id;
var url="http://a.xnimg.cn/a18102/swf/renren_widget/loader/widgetPlat.swf";
var html="<object width=\"100%\" height=\"100%\" id=\""+name+"\" name=\""+name+"\" type=\"application/x-shockwave-flash\" data=\""+url+"\">"+"<param name=\"allowScriptAccess\" value=\"always\" />"+"<param name=\"movie\" value=\""+url+"\" />"+"<param name=\"scale\" value=\"noscale\" />"+"<param name=\"flashVars\" value=\"conFileVerNum=19014&broswer="+_4c2+"&userId="+XN.user.id+"\" />"+"<param name=\"salign\" value=\"lt\" />"+"<param name=\"wmode\" value=\"transparent\" />"+"</object>";
var sp=document.createElement("div");
_4b9.appendChild(sp);
sp.innerHTML=html;
XN.renrenWidget.hideDash=hideDash;
XN.renrenWidget.showDash=showDash;
XN.renrenWidget.removeDash=removeDash;
XN.renrenWidget.doHideDash=doHideDash;
}
XN.event.addEvent(document,"keydown",function(e){
e=e||window.event;
if(e.keyCode==27){
XN.renrenWidget.hideDash&&XN.renrenWidget.hideDash();
}
});
function showWidget(){
try{
if(!_4bb){
try{
luanchRenrenWidget();
XN.renrenWidget.showDash();
}
catch(e){
XN.webpager.tools.logExpt("c07",e);
}
return;
}else{
XN.renrenWidget.showDash();
}
}
catch(e){
XN.webpager.tools.logExpt("c08",e);
}
}
XN.renrenWidget.showWidget=showWidget;
});
XN.namespace("webpager.plugins.Notificator");
(function(ns){
if(!window.webkitNotifications){
return;
}
XN.webpager.plugs("webpager.plugins.notificator",function(ns,ui,_4cb){
_4cb.addEvent("realTime_got",function(n){
var obj=XN.json.parse(n.content);
if(obj&&_4cb.isLocalConnect()){
if(obj.ugc_content&&obj.ugc_content!="empty"){
if((obj.from_id-0)==(XN.user.id-0)){
return;
}
var _4ce=XN.webpager.tools.unescapeHTML(obj.ugc_content);
window.webpager.notificationShow({head:obj.from_pic,name:obj.from_name,content:_4ce});
}
}
});
});
})(XN.webpager.plugins.Notificator);
XN.dom.ready(function(){
if(!XN.webpager){
return;
}
if(XN.disableWebpager){
return;
}
if(!window.$wp_messager){
$wp_messager={send:function(msg){
window.imengine.wpcontroller.onInputMessage(msg);
},getMessageHistory:function(u_id){
var ret=window.webpager.getMessageHistory(u_id);
return ret;
},getNotifyHistory:function(){
return window.webpager.getNotifyHistory();
}};
}
try{
XN.webpager.init();
}
catch(e){
_18.log1(e);
}
$.wpi.initApp().showApp();
if(window.webpagerLoader){
webpagerLoader.fireEvent("ui_ok");
}
var _4d2=$("wpi_rrWidget_trigger");
if(_4d2){
_4d2.addEvent("click",function(e){
e=e||window.event;
XN.renrenWidget.showWidget();
XN.event.stop(e);
return false;
});
}
});
})();
